diff --git a/onyx2/modules/db/postgresql.class.php b/onyx2/modules/db/postgresql.class.php index 6c800ea..0d13051 100644 --- a/onyx2/modules/db/postgresql.class.php +++ b/onyx2/modules/db/postgresql.class.php @@ -196,4 +196,14 @@ class BDD 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); + } }