Code Duplication    Length = 28-29 lines in 2 locations

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

@@ 996-1023 (lines=28) @@
993
        $total_score_obtained = 0;
994
        $total_score_possible = 0;
995
        $total_questions_answered = 0;
996
        while ($row = Database::fetch_object($result)) {
997
            // get time spent in the course and session
998
            $time_spent += Tracking::get_time_spent_on_the_course(
999
                $row->user_id,
1000
                $courseInfo['real_id']
1001
            );
1002
            $progress_tmp = Tracking::get_avg_student_progress(
1003
                $row->user_id,
1004
                $course_code,
1005
                array(),
1006
                null,
1007
                true
1008
            );
1009
            $progress += $progress_tmp[0];
1010
            $nb_progress_lp += $progress_tmp[1];
1011
            $score_tmp = Tracking::get_avg_student_score(
1012
                $row->user_id,
1013
                $course_code,
1014
                array(),
1015
                null,
1016
                true
1017
            );
1018
            if (is_array($score_tmp)) {
1019
                $score += $score_tmp[0];
1020
                $nb_score_lp += $score_tmp[1];
1021
            }
1022
            $nb_messages += Tracking::count_student_messages(
1023
                $row->user_id,
1024
                $course_code
1025
            );
1026
            $nb_assignments += Tracking::count_student_assignments(
@@ 1180-1208 (lines=29) @@
1177
            $total_score_obtained = 0;
1178
            $total_score_possible = 0;
1179
            $total_questions_answered = 0;
1180
            while ($row = Database::fetch_object($result)) {
1181
                // get time spent in the course and session
1182
                $time_spent += Tracking::get_time_spent_on_the_course(
1183
                    $row->user_id,
1184
                    $courseId
1185
                );
1186
                $progress_tmp = Tracking::get_avg_student_progress(
1187
                    $row->user_id,
1188
                    $course_code,
1189
                    array(),
1190
                    null,
1191
                    true
1192
                );
1193
                $progress += $progress_tmp[0];
1194
                $nb_progress_lp += $progress_tmp[1];
1195
                $score_tmp = Tracking::get_avg_student_score(
1196
                    $row->user_id,
1197
                    $course_code,
1198
                    array(),
1199
                    null,
1200
                    true
1201
                );
1202
                if (is_array($score_tmp)) {
1203
                    $score += $score_tmp[0];
1204
                    $nb_score_lp += $score_tmp[1];
1205
                }
1206
                $nb_messages += Tracking::count_student_messages(
1207
                    $row->user_id,
1208
                    $course_code
1209
                );
1210
                $nb_assignments += Tracking::count_student_assignments(
1211
                    $row->user_id,