Code Duplication    Length = 23-26 lines in 2 locations

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

@@ 5220-5245 (lines=26) @@
5217
        $final_array = array();
5218
        $my_final_array = array();
5219
5220
        for ($i=1; $i <=$pieces; $i++) {
5221
            $sum = 1;
5222
            if ($i == 1) {
5223
                $sum = 0;
5224
            }
5225
            $min = ($i-1)*$part + $sum;
5226
            $max = ($i)*$part;
5227
            $x_axis[]= $min." - ".$max;
5228
            $count = 0;
5229
            foreach($exercise_result as $result) {
5230
                $percentage = $result*100;
5231
                //echo $percentage.' - '.$min.' - '.$max."<br />";
5232
                if ($percentage >= $min && $percentage <= $max) {
5233
                    //echo ' is > ';
5234
                    $count++;
5235
                }
5236
            }
5237
            //echo '<br />';
5238
            $final_array[]= $count;
5239
5240
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5241
                $my_final_array[] = 1;
5242
            } else {
5243
                $my_final_array[] = 0;
5244
            }
5245
        }
5246
5247
        //Fix to remove the data of the user with my data
5248
        for($i = 0; $i<=count($my_final_array); $i++) {
@@ 5395-5417 (lines=23) @@
5392
        $final_array = array();
5393
        $my_final_array = array();
5394
5395
        for ($i=1; $i <=$pieces; $i++) {
5396
            $sum = 1;
5397
            if ($i == 1) {
5398
                $sum = 0;
5399
            }
5400
            $min = ($i-1)*$part + $sum;
5401
            $max = ($i)*$part;
5402
            $x_axis[]= $min." - ".$max;
5403
            $count = 0;
5404
            foreach($exercise_result as $result) {
5405
                $percentage = $result*100;
5406
                if ($percentage >= $min && $percentage <= $max) {
5407
                    $count++;
5408
                }
5409
            }
5410
            $final_array[]= $count;
5411
5412
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5413
                $my_final_array[] = 1;
5414
            } else {
5415
                $my_final_array[] = 0;
5416
            }
5417
        }
5418
5419
        //Fix to remove the data of the user with my data
5420