Ajout du code pour mettre à jour le classement via postgresql aussi

This commit is contained in:
Nigel Sheldon 2021-01-01 14:26:24 +01:00
parent 52e99ddea8
commit 4cda71a337

View File

@ -196,4 +196,14 @@ class BDD
return pg_affected_rows($this->reponse); return pg_affected_rows($this->reponse);
} }
public function update_classement()
{
if (!$this->session) {
return false;
}
global $table_user;
$query = "UPDATE $table_user SET place_points=subquery.rn FROM (SELECT id, points, place_points, row_number() over (order by points DESC) as rn FROM $table_user) AS subquery WHERE $table_user.id=subquery.id;";
pg_query($this->session, $query);
}
} }