]> git.xonotic.org Git - xonotic/xonstatdb.git/commitdiff
Merge branch 'master' of github.com:antzucaro/xonstatdb
authorAnt Zucaro <azucaro@gmail.com>
Wed, 28 May 2014 00:36:41 +0000 (20:36 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Wed, 28 May 2014 00:36:41 +0000 (20:36 -0400)
scripts/update_elos.sql

index f724e0313935a10826dbc785216900560ca670ac..bda0ae25900fd0d921ac94a3423985b348b40fff 100644 (file)
@@ -1,6 +1,12 @@
 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')
+  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;