From d5ad2473adaa11fd8da2edf3e30d5a20a4831e2a Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Fri, 11 Aug 2017 10:01:53 +0200
Subject: update updated_at on duplicate

---
 crunch_player.sql | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'crunch_player.sql')

diff --git a/crunch_player.sql b/crunch_player.sql
index c102f44..4e449f3 100644
--- a/crunch_player.sql
+++ b/crunch_player.sql
@@ -1,7 +1,7 @@
 insert low_priority into `player_point`
 select
     null,
-    p.created_at,
+    p.created_at as updated_at,
     p.player_api_id,
     s.id as series_id,
     f.id as filter_id,
@@ -50,6 +50,7 @@ group by p.player_api_id, s.id, f.id, h.id, gm.id, r.id
 order by p.id
 
 on duplicate key update
+updated_at = case when values(updated_at) > updated_a then values(updated_at) else updated_at end,
 played = played + values(played),
 wins = wins + values(wins),
 trueskill_max = case when values(trueskill_max) > trueskill_max then values(trueskill_max) else trueskill_max end,
-- 
cgit v1.3.1

