To be reviewed - fix to negative total time connected to the platform

skala
ywarnier 15 years ago
parent c4d589fab2
commit d5f3fba812
  1. 16
      main/inc/lib/tracking.lib.php

@ -51,12 +51,16 @@ class Tracking {
$i_timestamp_login_date = strtotime($s_login_date);
$i_timestamp_logout_date = strtotime($s_logout_date);
if($i_timestamp_logout_date>0)
{
$nb_seconds += ($i_timestamp_logout_date - $i_timestamp_login_date);
}
else
{ // there are wrong datas in db, then we can't give a wrong time
if ($i_timestamp_logout_date > 0) {
// @TODO YW 20110708: for some reason the result here is often
// negative, resulting in a negative time total. Considering the
// logout_date is > 0, this can only mean that the database
// contains items where the login_date is higher (=later) than
// the logout date for a specific connexion. This has to be
// analyzed and fixed. Also see the get_time_spent_on_the_course
// for SQL summing.
$nb_seconds += abs($i_timestamp_logout_date - $i_timestamp_login_date);
} else { // there are wrong datas in db, then we can't give a wrong time
$wrong_logout_dates = true;
}

Loading…
Cancel
Save