Code Duplication    Length = 23-26 lines in 2 locations

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

@@ 5088-5113 (lines=26) @@
5085
        $final_array = array();
5086
        $my_final_array = array();
5087
5088
        for ($i=1; $i <=$pieces; $i++) {
5089
            $sum = 1;
5090
            if ($i == 1) {
5091
                $sum = 0;
5092
            }
5093
            $min = ($i-1)*$part + $sum;
5094
            $max = ($i)*$part;
5095
            $x_axis[]= $min." - ".$max;
5096
            $count = 0;
5097
            foreach($exercise_result as $result) {
5098
                $percentage = $result*100;
5099
                //echo $percentage.' - '.$min.' - '.$max."<br />";
5100
                if ($percentage >= $min && $percentage <= $max) {
5101
                    //echo ' is > ';
5102
                    $count++;
5103
                }
5104
            }
5105
            //echo '<br />';
5106
            $final_array[]= $count;
5107
5108
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5109
                $my_final_array[] = 1;
5110
            } else {
5111
                $my_final_array[] = 0;
5112
            }
5113
        }
5114
5115
        //Fix to remove the data of the user with my data
5116
        for($i = 0; $i<=count($my_final_array); $i++) {
@@ 5263-5285 (lines=23) @@
5260
        $final_array = array();
5261
        $my_final_array = array();
5262
5263
        for ($i=1; $i <=$pieces; $i++) {
5264
            $sum = 1;
5265
            if ($i == 1) {
5266
                $sum = 0;
5267
            }
5268
            $min = ($i-1)*$part + $sum;
5269
            $max = ($i)*$part;
5270
            $x_axis[]= $min." - ".$max;
5271
            $count = 0;
5272
            foreach($exercise_result as $result) {
5273
                $percentage = $result*100;
5274
                if ($percentage >= $min && $percentage <= $max) {
5275
                    $count++;
5276
                }
5277
            }
5278
            $final_array[]= $count;
5279
5280
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5281
                $my_final_array[] = 1;
5282
            } else {
5283
                $my_final_array[] = 0;
5284
            }
5285
        }
5286
5287
        //Fix to remove the data of the user with my data
5288