]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blob - scripts/update_ranks.sql
Add TKA to the full build.
[xonotic/xonstatdb.git] / scripts / update_ranks.sql
1 begin;
2     -- save the history
3     insert into player_ranks_history
4     select * from player_ranks;
5
6     -- get rid of the existing ranks and refresh them using
7     -- the latest elo information for each game type
8     delete from player_ranks;
9
10     insert into player_ranks(player_id, nick, game_type_cd, elo, rank)
11     select p.player_id, p.nick, pe.game_type_cd, pe.elo, row_number() 
12     over (partition by pe.game_type_cd order by pe.elo desc, pe.create_dt)
13     from players p, player_elos pe
14     where p.player_id = pe.player_id
15     and p.active_ind = True
16     and pe.active_ind = True
17     --and pe.games >= 32
18     and pe.elo > 100;
19
20 end;