From 0a9d4c559df8f94a0ad5d2177d654f5bfb6bfaa5 Mon Sep 17 00:00:00 2001 From: antzucaro Date: Sat, 17 Aug 2013 00:12:14 -0400 Subject: [PATCH] Add Elo rot analysis query. --- queries/show_elo_rot.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 queries/show_elo_rot.sql diff --git a/queries/show_elo_rot.sql b/queries/show_elo_rot.sql new file mode 100644 index 0000000..eccbe6d --- /dev/null +++ b/queries/show_elo_rot.sql @@ -0,0 +1,13 @@ +select + player_id, + game_type_cd, + elo current_elo, + update_dt last_update_dt, + (current_date - (update_dt::date)) number_of_days, + (current_date - (update_dt::date))-30 number_of_days_past_30, + (current_date - (update_dt::date)-31)/7 penalty, + greatest(100, elo - ((current_date - (update_dt::date)-31)/7)) new_elo +from player_elos +where + update_dt < (current_timestamp at time zone 'UTC' - interval '30 days') + and elo != 100; -- 2.39.2