Code Duplication    Length = 23-26 lines in 2 locations

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

@@ 5210-5235 (lines=26) @@
5207
        $final_array = array();
5208
        $my_final_array = array();
5209
5210
        for ($i=1; $i <=$pieces; $i++) {
5211
            $sum = 1;
5212
            if ($i == 1) {
5213
                $sum = 0;
5214
            }
5215
            $min = ($i-1)*$part + $sum;
5216
            $max = ($i)*$part;
5217
            $x_axis[]= $min." - ".$max;
5218
            $count = 0;
5219
            foreach($exercise_result as $result) {
5220
                $percentage = $result*100;
5221
                //echo $percentage.' - '.$min.' - '.$max."<br />";
5222
                if ($percentage >= $min && $percentage <= $max) {
5223
                    //echo ' is > ';
5224
                    $count++;
5225
                }
5226
            }
5227
            //echo '<br />';
5228
            $final_array[]= $count;
5229
5230
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5231
                $my_final_array[] = 1;
5232
            } else {
5233
                $my_final_array[] = 0;
5234
            }
5235
        }
5236
5237
        //Fix to remove the data of the user with my data
5238
        for($i = 0; $i<=count($my_final_array); $i++) {
@@ 5385-5407 (lines=23) @@
5382
        $final_array = array();
5383
        $my_final_array = array();
5384
5385
        for ($i=1; $i <=$pieces; $i++) {
5386
            $sum = 1;
5387
            if ($i == 1) {
5388
                $sum = 0;
5389
            }
5390
            $min = ($i-1)*$part + $sum;
5391
            $max = ($i)*$part;
5392
            $x_axis[]= $min." - ".$max;
5393
            $count = 0;
5394
            foreach($exercise_result as $result) {
5395
                $percentage = $result*100;
5396
                if ($percentage >= $min && $percentage <= $max) {
5397
                    $count++;
5398
                }
5399
            }
5400
            $final_array[]= $count;
5401
5402
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5403
                $my_final_array[] = 1;
5404
            } else {
5405
                $my_final_array[] = 0;
5406
            }
5407
        }
5408
5409
        //Fix to remove the data of the user with my data
5410