Code Duplication    Length = 23-26 lines in 2 locations

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

@@ 5137-5162 (lines=26) @@
5134
        $final_array = array();
5135
        $my_final_array = array();
5136
5137
        for ($i=1; $i <=$pieces; $i++) {
5138
            $sum = 1;
5139
            if ($i == 1) {
5140
                $sum = 0;
5141
            }
5142
            $min = ($i-1)*$part + $sum;
5143
            $max = ($i)*$part;
5144
            $x_axis[]= $min." - ".$max;
5145
            $count = 0;
5146
            foreach($exercise_result as $result) {
5147
                $percentage = $result*100;
5148
                //echo $percentage.' - '.$min.' - '.$max."<br />";
5149
                if ($percentage >= $min && $percentage <= $max) {
5150
                    //echo ' is > ';
5151
                    $count++;
5152
                }
5153
            }
5154
            //echo '<br />';
5155
            $final_array[]= $count;
5156
5157
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5158
                $my_final_array[] = 1;
5159
            } else {
5160
                $my_final_array[] = 0;
5161
            }
5162
        }
5163
5164
        //Fix to remove the data of the user with my data
5165
        for($i = 0; $i<=count($my_final_array); $i++) {
@@ 5312-5334 (lines=23) @@
5309
        $final_array = array();
5310
        $my_final_array = array();
5311
5312
        for ($i=1; $i <=$pieces; $i++) {
5313
            $sum = 1;
5314
            if ($i == 1) {
5315
                $sum = 0;
5316
            }
5317
            $min = ($i-1)*$part + $sum;
5318
            $max = ($i)*$part;
5319
            $x_axis[]= $min." - ".$max;
5320
            $count = 0;
5321
            foreach($exercise_result as $result) {
5322
                $percentage = $result*100;
5323
                if ($percentage >= $min && $percentage <= $max) {
5324
                    $count++;
5325
                }
5326
            }
5327
            $final_array[]= $count;
5328
5329
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5330
                $my_final_array[] = 1;
5331
            } else {
5332
                $my_final_array[] = 0;
5333
            }
5334
        }
5335
5336
        //Fix to remove the data of the user with my data
5337