Minor - mysql error + format float.

1.9.x
Julio Montoya 11 years ago
parent a2653a4c5c
commit 0d73a8c6e2
  1. 13
      main/inc/lib/tracking.lib.php
  2. 20
      main/mySpace/index.php

@ -86,10 +86,10 @@ class Tracking
/**
* Calculates the time spent on the course
* @param integer User id
* @param string Course code
* @param int Session id (optional)
* @return timestamp Time in seconds
* @param integer $user_id
* @param string $course_code
* @param int Session id (optional)
* @return timestamp Time in seconds
*/
public static function get_time_spent_on_the_course($user_id, $course_code, $session_id = 0)
{
@ -105,10 +105,7 @@ class Tracking
$condition_user = " AND user_id = '$user_id' ";
}
$sql = "SELECT
SUM (
UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)
) as nb_seconds
$sql = "SELECT SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds
FROM $tbl_track_course
WHERE
UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) AND

@ -315,14 +315,14 @@ if (!empty($students)) {
if ($export_csv) {
//csv part
$csv_content[] = array(get_lang('Students', ''));
$csv_content[] = array(get_lang('InactivesStudents', ''), $nb_inactive_students);
$csv_content[] = array(get_lang('AverageTimeSpentOnThePlatform', ''), $avg_time_spent);
$csv_content[] = array(get_lang('AverageCoursePerStudent', ''), $avg_courses_per_student);
$csv_content[] = array(get_lang('AverageProgressInLearnpath', ''), is_null($avg_total_progress) ? null : round($avg_total_progress, 2).'%');
$csv_content[] = array(get_lang('AverageResultsToTheExercices', ''), is_null($avg_results_to_exercises) ? null : round($avg_results_to_exercises, 2).'%');
$csv_content[] = array(get_lang('AveragePostsInForum', ''), $nb_posts);
$csv_content[] = array(get_lang('AverageAssignments', ''), $nb_assignments);
$csv_content[] = array(get_lang('Students'));
$csv_content[] = array(get_lang('InactivesStudents'), $nb_inactive_students);
$csv_content[] = array(get_lang('AverageTimeSpentOnThePlatform'), $avg_time_spent);
$csv_content[] = array(get_lang('AverageCoursePerStudent'), $avg_courses_per_student);
$csv_content[] = array(get_lang('AverageProgressInLearnpath'), is_null($avg_total_progress) ? null : round($avg_total_progress, 2).'%');
$csv_content[] = array(get_lang('AverageResultsToTheExercices'), is_null($avg_results_to_exercises) ? null : round($avg_results_to_exercises, 2).'%');
$csv_content[] = array(get_lang('AveragePostsInForum'), $nb_posts);
$csv_content[] = array(get_lang('AverageAssignments'), $nb_assignments);
$csv_content[] = array();
} else {
$lastConnectionDate = api_get_utc_datetime(strtotime('15 days ago'));
@ -357,7 +357,7 @@ if (!empty($students)) {
</tr>
<tr>
<td>'.get_lang('AverageCoursePerStudent').'</td>
<td align="right">'.(is_null($avg_courses_per_student) ? '' : $avg_courses_per_student).'</td>
<td align="right">'.(is_null($avg_courses_per_student) ? '' : round($avg_courses_per_student, 2)).'</td>
</tr>
<tr>
<td>'.get_lang('InactivesStudents').'</td>
@ -384,7 +384,7 @@ if (!empty($students)) {
<td align="right">'.(is_null($nb_assignments) ? '' : round($nb_assignments, 2)).'</td>
</tr>
</table>
<a class="btn" href="'.api_get_path(WEB_CODE_PATH).'mySpace/student.php'.'">
<a class="btn" href="'.api_get_path(WEB_CODE_PATH).'mySpace/student.php">
'.get_lang('SeeStudentList').'
</a>
</div><br />';

Loading…
Cancel
Save