Add timestamp comparison in ranking system

This commit is contained in:
Quentin Grosyeux 2013-11-25 23:06:26 +01:00
parent 124a7c2a32
commit 62fca492ad

View File

@ -5,7 +5,21 @@ if(!defined('ONYX')) exit;
function cmp_team_pts($i1, $i2)
{
if ($i1->get_pts() == $i2->get_pts()){
return 0;
$db = new BDD();
$timestampi1 = $db->unique_query("SELECT MAX( s.time ) AS maxTime
FROM solved AS s
WHERE s.id_team =".$i1);
$timestampi2 = $db->unique_query("SELECT MAX( s.time ) AS maxTime
FROM solved AS s
WHERE s.id_team =".$i12);
$db->deconnexion();
if ($timestampi1 < $timestampi2){
return 1
else
return -1
}
else{
return ($i1->get_pts() < $i2->get_pts()) ? 1 : -1;