mysql's TIMEDIFF seems to have changed... comparing <=0 didn't work correctly anymore.
Changed it to convert to seconds and then compare those against <=0 and use that data to calculate game number
Signed-off-by: Arun Persaud <arun@nubati.net>
$session = DB_get_session_by_gameid($gameid);
/* get number of game */
$session = DB_get_session_by_gameid($gameid);
/* get number of game */
- $r = DB_query_array("SELECT COUNT(*),create_date FROM Game".
- " WHERE session='$session' ".
- " AND TIMEDIFF(create_date, (SELECT create_date FROM Game WHERE id='$gameid'))<=0 ".
- " GROUP by session");
+ $r = DB_query_array("SELECT SUM(TIME_TO_SEC(TIMEDIFF(create_date, (SELECT create_date FROM Game WHERE id='$gameid')))<=0) ".
+ " FROM Game".
+ " WHERE session='$session' ");
return $session.".".$r[0];
}
return $session.".".$r[0];
}