Code Duplication    Length = 23-26 lines in 2 locations

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

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