Code Duplication    Length = 23-26 lines in 2 locations

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

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