Code Duplication    Length = 23-26 lines in 2 locations

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

@@ 5802-5827 (lines=26) @@
5799
        $final_array = array();
5800
        $my_final_array = array();
5801
5802
        for ($i = 1; $i <= $pieces; $i++) {
5803
            $sum = 1;
5804
            if ($i == 1) {
5805
                $sum = 0;
5806
            }
5807
            $min = ($i - 1) * $part + $sum;
5808
            $max = ($i) * $part;
5809
            $x_axis[] = $min." - ".$max;
5810
            $count = 0;
5811
            foreach ($exercise_result as $result) {
5812
                $percentage = $result * 100;
5813
                //echo $percentage.' - '.$min.' - '.$max."<br />";
5814
                if ($percentage >= $min && $percentage <= $max) {
5815
                    //echo ' is > ';
5816
                    $count++;
5817
                }
5818
            }
5819
            //echo '<br />';
5820
            $final_array[] = $count;
5821
5822
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5823
                $my_final_array[] = 1;
5824
            } else {
5825
                $my_final_array[] = 0;
5826
            }
5827
        }
5828
5829
        //Fix to remove the data of the user with my data
5830
        for ($i = 0; $i <= count($my_final_array); $i++) {
@@ 5990-6012 (lines=23) @@
5987
        $final_array = array();
5988
        $my_final_array = array();
5989
5990
        for ($i = 1; $i <= $pieces; $i++) {
5991
            $sum = 1;
5992
            if ($i == 1) {
5993
                $sum = 0;
5994
            }
5995
            $min = ($i - 1) * $part + $sum;
5996
            $max = ($i) * $part;
5997
            $x_axis[] = $min." - ".$max;
5998
            $count = 0;
5999
            foreach ($exercise_result as $result) {
6000
                $percentage = $result * 100;
6001
                if ($percentage >= $min && $percentage <= $max) {
6002
                    $count++;
6003
                }
6004
            }
6005
            $final_array[] = $count;
6006
6007
            if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
6008
                $my_final_array[] = 1;
6009
            } else {
6010
                $my_final_array[] = 0;
6011
            }
6012
        }
6013
6014
        //Fix to remove the data of the user with my data
6015