From a547f80e220921be7b7c8c5068838cc278b630f5 Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Thu, 2 Mar 2017 18:36:32 +0100
Subject: process missing stats

---
 queries/player/count_player_matches.sql | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'queries/player/count_player_matches.sql')

diff --git a/queries/player/count_player_matches.sql b/queries/player/count_player_matches.sql
index ddfbb66..db5a2de 100644
--- a/queries/player/count_player_matches.sql
+++ b/queries/player/count_player_matches.sql
@@ -1,7 +1,7 @@
 with stats as (
 with plr as (
 select 
-    'a' as patch_version,
+    'a'::text as "patchVersion",
     player."apiId" as player_api_id,
     match."gameMode" as game_mode,
     participant."winner" as winner
@@ -14,12 +14,14 @@ where
     player."apiId" = $1)
 select
     (select distinct(player_api_id) from plr),
+    (select distinct("patchVersion") as "patchVersion" from plr),
     (select count(*) as played from plr), 
     (select count(*) as wins from plr where winner = true), 
     (select count(*) as casual_played from plr where game_mode like '%casual%'),
     (select count(*) as casual_wins from plr where game_mode like '%casual%' and winner = true),
     (select count(*) as ranked_played from plr where game_mode like '%ranked%'),
-    (select count(*) as ranked_wins from plr where game_mode like '%ranked%' and winner = true)
+    (select count(*) as ranked_wins from plr where game_mode like '%ranked%' and winner = true),
+    (select 0 as streak)
 )
-INSERT INTO player_stats("player_apiId", played, wins, casual_played, casual_wins, ranked_played, ranked_wins)
+INSERT INTO player_stats("player_apiId", "patchVersion", played, wins, casual_played, casual_wins, ranked_played, ranked_wins, streak)
     SELECT * FROM stats
-- 
cgit v1.3.1

