From: Ant Zucaro Date: Mon, 10 Feb 2014 23:32:54 +0000 (-0500) Subject: Playing one Elo game type in the past 30 days will prevent rot. X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonstatdb.git;a=commitdiff_plain;h=c018870ecda8133a30e2c23438a59e28de34a3ea Playing one Elo game type in the past 30 days will prevent rot. --- diff --git a/scripts/update_elos.sql b/scripts/update_elos.sql index f724e03..bda0ae2 100644 --- a/scripts/update_elos.sql +++ b/scripts/update_elos.sql @@ -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;