From 392160fdbbb45a93ebc90d57577fb62227de4c5e Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Sat, 1 Apr 2017 12:02:40 +0200
Subject: rewrite in node

---
 queries/participant/stats.sql | 21 ---------------------
 1 file changed, 21 deletions(-)
 delete mode 100644 queries/participant/stats.sql

(limited to 'queries/participant/stats.sql')

diff --git a/queries/participant/stats.sql b/queries/participant/stats.sql
deleted file mode 100644
index fe4025f..0000000
--- a/queries/participant/stats.sql
+++ /dev/null
@@ -1,21 +0,0 @@
-WITH stats AS (
-    SELECT
-        participant.api_id,
-        match.patch_version,
-        CASE WHEN roster.hero_kills=0
-        THEN 0
-        ELSE (kills+assists)/roster.hero_kills::float
-        END AS kills_participation,
-        CASE WHEN participant.deaths=0
-        THEN 0
-        ELSE (kills+assists)/deaths::float
-        END AS kda
-    FROM participant
-    JOIN roster ON roster.api_id=participant.roster_api_id
-    JOIN match ON match.api_id=roster.match_api_id
-    WHERE participant.api_id = $1
-)
-INSERT INTO participant_stats(participant_api_id, patch_version, kills_participation, kda)
-SELECT * FROM stats
-ON CONFLICT(participant_api_id) DO
-UPDATE SET(participant_api_id, patch_version, kills_participation, kda) = (SELECT * FROM stats)
-- 
cgit v1.3.1

