]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blob - scripts/update_elos.sql
Add TKA to the full build.
[xonotic/xonstatdb.git] / scripts / update_elos.sql
1 begin;
2   update player_elos pe
3   set elo=greatest(100, elo - ((current_date - (update_dt::date)-31)/7+1))
4   where update_dt < (current_timestamp at time zone 'UTC' - interval '30 days')
5   and not exists (
6     select 1
7     from player_elos
8     where player_id = pe.player_id
9     and update_dt >= (current_timestamp at time zone 'UTC' - interval '30 days')
10   )
11   and elo != 100;
12 end;