From 94f025db5247bb7b88c64c1f8d3c2e7d0134033d Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Mon, 24 Apr 2017 23:34:40 +0200
Subject: rework cruncher

---
 crunch_global.sql | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

(limited to 'crunch_global.sql')

diff --git a/crunch_global.sql b/crunch_global.sql
index b0fae3a..7bb6263 100644
--- a/crunch_global.sql
+++ b/crunch_global.sql
@@ -1,8 +1,3 @@
-INSERT IGNORE INTO `keys` (`id`, `key`, `value`) VALUES(3, 'last_participant_crunched', 0), (4, 'participant_crunch_steps', 1000);
-
-SET @lpcid = (SELECT `value` FROM `keys` WHERE `key`='last_participant_crunched');
-SET @lpc_step = (SELECT `value` FROM `keys` WHERE `key`='participant_crunch_steps');
-
 INSERT LOW_PRIORITY INTO global_point
 SELECT
     NULL,
@@ -64,7 +59,7 @@ JOIN `build` ON `build`.`name` = 'all'
 JOIN `role` ON `role`.`id` = `participant`.`role_id` OR `role`.`name` = 'all'
 JOIN `region` ON `region`.`name` = `participant`.`shard_id` OR `region`.`name` = 'all'
 
-WHERE `participant`.`id` > (SELECT @lpcid) and `participant`.`id` < (SELECT @lpcid + @lpc_step)
+WHERE `participant`.`api_id` IN (:participant_api_ids)
 
 GROUP BY `series`.`id`, `filter`.`id`, `hero`.`id`, `game_mode`.`id`, `skill_tier`.`id`, `build`.`id`, `role`.`id`, `region`.`id`
 ORDER BY `participant`.`id`
@@ -105,6 +100,4 @@ ON DUPLICATE KEY UPDATE
 `utility_score` = `utility_score` + VALUES(`utility_score`),
 `synergy_score` = `synergy_score` + VALUES(`synergy_score`),
 `build_score` = `build_score` + VALUES(`build_score`),
-`offmeta_score` = `offmeta_score` + VALUES(`offmeta_score`);
-
-UPDATE `keys` SET `value` = (SELECT @lpcid + @lpc_step) WHERE `key` = 'last_participant_crunched';
+`offmeta_score` = `offmeta_score` + VALUES(`offmeta_score`)
-- 
cgit v1.3.1

