From 638dfbd946e249f2dfd1acee3d9a1a0ec1b16468 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sat, 21 Apr 2012 16:30:37 -0400 Subject: [PATCH] Default games to 1 in another place. --- functions/merge_players.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/merge_players.sql b/functions/merge_players.sql index 491f545..b76853b 100644 --- a/functions/merge_players.sql +++ b/functions/merge_players.sql @@ -31,7 +31,7 @@ begin -- take the weighted average of the elos and sum the games to get the new total FOR weighted_elo IN (select game_type_cd, elo_sum/game_count aggregate_elo, game_count from ( - select game_type_cd, greatest(sum(games*elo),1) elo_sum, sum(games) game_count + select game_type_cd, sum(greatest(games, 1)*elo) elo_sum, greatest(sum(games),1) game_count from player_elos where player_id in (p_winner_player_id, p_loser_player_id) group by game_type_cd -- 2.39.2