Code Duplication    Length = 23-26 lines in 2 locations

main/inc/lib/tracking.lib.php 2 locations

@@ 5177-5202 (lines=26) @@
5174
        $final_array = array();
5175
        $my_final_array = array();
5176
5177
        for ($i=1; $i <=$pieces; $i++) {
5178
            $sum = 1;
5179
            if ($i == 1) {
5180
                $sum = 0;
5181
            }
5182
            $min = ($i-1)*$part + $sum;
5183
            $max = ($i)*$part;
5184
            $x_axis[]= $min." - ".$max;
5185
            $count = 0;
5186
            foreach($exercise_result as $result) {
5187
                $percentage = $result*100;
5188
                //echo $percentage.' - '.$min.' - '.$max."<br />";
5189
                if ($percentage >= $min && $percentage <= $max) {
5190
                    //echo ' is > ';
5191
                    $count++;
5192
                }
5193
            }
5194
            //echo '<br />';
5195
            $final_array[]= $count;
5196
5197
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5198
                $my_final_array[] = 1;
5199
            } else {
5200
                $my_final_array[] = 0;
5201
            }
5202
        }
5203
5204
        //Fix to remove the data of the user with my data
5205
        for($i = 0; $i<=count($my_final_array); $i++) {
@@ 5352-5374 (lines=23) @@
5349
        $final_array = array();
5350
        $my_final_array = array();
5351
5352
        for ($i=1; $i <=$pieces; $i++) {
5353
            $sum = 1;
5354
            if ($i == 1) {
5355
                $sum = 0;
5356
            }
5357
            $min = ($i-1)*$part + $sum;
5358
            $max = ($i)*$part;
5359
            $x_axis[]= $min." - ".$max;
5360
            $count = 0;
5361
            foreach($exercise_result as $result) {
5362
                $percentage = $result*100;
5363
                if ($percentage >= $min && $percentage <= $max) {
5364
                    $count++;
5365
                }
5366
            }
5367
            $final_array[]= $count;
5368
5369
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5370
                $my_final_array[] = 1;
5371
            } else {
5372
                $my_final_array[] = 0;
5373
            }
5374
        }
5375
5376
        //Fix to remove the data of the user with my data
5377