]> de.git.xonotic.org Git - xonotic/xonstatdb.git/commitdiff
Playing one Elo game type in the past 30 days will prevent rot.
authorAnt Zucaro <azucaro@gmail.com>
Mon, 10 Feb 2014 23:32:54 +0000 (18:32 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Mon, 10 Feb 2014 23:32:54 +0000 (18:32 -0500)
scripts/update_elos.sql

index f724e0313935a10826dbc785216900560ca670ac..bda0ae25900fd0d921ac94a3423985b348b40fff 100644 (file)
@@ -1,6 +1,12 @@
 begin;
 begin;
-  update player_elos
+  update player_elos pe
   set elo=greatest(100, elo - ((current_date - (update_dt::date)-31)/7+1))
   where update_dt < (current_timestamp at time zone 'UTC' - interval '30 days')
   set elo=greatest(100, elo - ((current_date - (update_dt::date)-31)/7+1))
   where update_dt < (current_timestamp at time zone 'UTC' - interval '30 days')
+  and not exists (
+    select 1
+    from player_elos
+    where player_id = pe.player_id
+    and update_dt >= (current_timestamp at time zone 'UTC' - interval '30 days')
+  )
   and elo != 100;
 end;
   and elo != 100;
 end;