]> de.git.xonotic.org Git - xonotic/xonstatdb.git/commitdiff
Damn off-by-one errors. *shakes fist*
authorantzucaro <azucaro@gmail.com>
Sat, 17 Aug 2013 04:34:33 +0000 (00:34 -0400)
committerantzucaro <azucaro@gmail.com>
Sat, 17 Aug 2013 04:34:33 +0000 (00:34 -0400)
queries/show_elo_rot.sql
scripts/update_elos.sql

index eccbe6d471b31fb3d6bdf3b2336f16422b004ea1..33f415dcb619be75a9edae090d3c172fc71734bb 100644 (file)
@@ -5,8 +5,8 @@ select
   update_dt last_update_dt, 
   (current_date - (update_dt::date)) number_of_days, 
   (current_date - (update_dt::date))-30 number_of_days_past_30, 
   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
+  (current_date - (update_dt::date)-31)/7+1 penalty,
+  greatest(100, elo - ((current_date - (update_dt::date)-31)/7+1)) new_elo
 from player_elos
 where 
   update_dt < (current_timestamp at time zone 'UTC' - interval '30 days')
 from player_elos
 where 
   update_dt < (current_timestamp at time zone 'UTC' - interval '30 days')
index 38d456d8aa2eabd5ba03500b5612a9b3ccd0cef0..f724e0313935a10826dbc785216900560ca670ac 100644 (file)
@@ -1,6 +1,6 @@
 begin;
   update player_elos
 begin;
   update player_elos
-  set elo=greatest(100, elo - ((current_date - (update_dt::date)-31)/7))
+  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 elo != 100;
 end;
   where update_dt < (current_timestamp at time zone 'UTC' - interval '30 days')
   and elo != 100;
 end;