@@ 1643-1672 (lines=30) @@ | ||
1640 | $total_score_obtained = 0; |
|
1641 | $total_score_possible = 0; |
|
1642 | $total_questions_answered = 0; |
|
1643 | while ($row_user = Database::fetch_object($result_users)) { |
|
1644 | // get time spent in the course and session |
|
1645 | $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id); |
|
1646 | $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true); |
|
1647 | $progress += $progress_tmp[0]; |
|
1648 | $nb_progress_lp += $progress_tmp[1]; |
|
1649 | $score_tmp = Tracking :: get_avg_student_score($row_user->user_id, $row->code, array(), $session_id, true); |
|
1650 | if (is_array($score_tmp)) { |
|
1651 | $score += $score_tmp[0]; |
|
1652 | $nb_score_lp += $score_tmp[1]; |
|
1653 | } |
|
1654 | $nb_messages += Tracking::count_student_messages($row_user->user_id, $row->code, $session_id); |
|
1655 | $nb_assignments += Tracking::count_student_assignments($row_user->user_id, $row->code, $session_id); |
|
1656 | $last_login_date_tmp = Tracking::get_last_connection_date_on_the_course($row_user->user_id, $courseInfo, $session_id, false); |
|
1657 | if ($last_login_date_tmp != false && $last_login_date == false) { |
|
1658 | // TODO: To be cleaned. |
|
1659 | $last_login_date = $last_login_date_tmp; |
|
1660 | } else if($last_login_date_tmp != false && $last_login_date != false) { |
|
1661 | // TODO: Repeated previous condition! To be cleaned. |
|
1662 | // Find the max and assign it to first_login_date |
|
1663 | if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1664 | $last_login_date = $last_login_date_tmp; |
|
1665 | } |
|
1666 | } |
|
1667 | ||
1668 | $exercise_results_tmp = MySpace::exercises_results($row_user->user_id, $row->code, $session_id); |
|
1669 | $total_score_obtained += $exercise_results_tmp['score_obtained']; |
|
1670 | $total_score_possible += $exercise_results_tmp['score_possible']; |
|
1671 | $total_questions_answered += $exercise_results_tmp['questions_answered']; |
|
1672 | } |
|
1673 | if($nb_progress_lp > 0) { |
|
1674 | $avg_progress = round($progress / $nb_progress_lp, 2); |
|
1675 | } else { |
|
@@ 1804-1846 (lines=43) @@ | ||
1801 | $total_score_obtained = 0; |
|
1802 | $total_score_possible = 0; |
|
1803 | $total_questions_answered = 0; |
|
1804 | while($row_user = Database::fetch_object($result_users)) { |
|
1805 | // get time spent in the course and session |
|
1806 | $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id); |
|
1807 | $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true); |
|
1808 | $progress += $progress_tmp[0]; |
|
1809 | $nb_progress_lp += $progress_tmp[1]; |
|
1810 | $score_tmp = Tracking :: get_avg_student_score($row_user->user_id, $row->code, array(), $session_id, true); |
|
1811 | if (is_array($score_tmp)) { |
|
1812 | $score += $score_tmp[0]; |
|
1813 | $nb_score_lp += $score_tmp[1]; |
|
1814 | } |
|
1815 | $nb_messages += Tracking::count_student_messages( |
|
1816 | $row_user->user_id, |
|
1817 | $row->code, |
|
1818 | $session_id |
|
1819 | ); |
|
1820 | ||
1821 | $nb_assignments += Tracking::count_student_assignments( |
|
1822 | $row_user->user_id, |
|
1823 | $row->code, |
|
1824 | $session_id |
|
1825 | ); |
|
1826 | ||
1827 | $last_login_date_tmp = Tracking:: get_last_connection_date_on_the_course( |
|
1828 | $row_user->user_id, |
|
1829 | $courseInfo, |
|
1830 | $session_id, |
|
1831 | false |
|
1832 | ); |
|
1833 | if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned. |
|
1834 | $last_login_date = $last_login_date_tmp; |
|
1835 | } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned. |
|
1836 | // Find the max and assign it to first_login_date |
|
1837 | if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1838 | $last_login_date = $last_login_date_tmp; |
|
1839 | } |
|
1840 | } |
|
1841 | ||
1842 | $exercise_results_tmp = MySpace::exercises_results($row_user->user_id, $row->code, $session_id); |
|
1843 | $total_score_obtained += $exercise_results_tmp['score_obtained']; |
|
1844 | $total_score_possible += $exercise_results_tmp['score_possible']; |
|
1845 | $total_questions_answered += $exercise_results_tmp['questions_answered']; |
|
1846 | } |
|
1847 | if($nb_progress_lp > 0) { |
|
1848 | $avg_progress = round($progress / $nb_progress_lp, 2); |
|
1849 | } else { |