From 718339cf0446798e10d1591273077905137e7392 Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Fri, 21 Jul 2017 11:40:23 +0200
Subject: global point: pay respect to dimension_on

---
 crunch_global.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'crunch_global.sql')

diff --git a/crunch_global.sql b/crunch_global.sql
index 3b14885..0a2ab4b 100644
--- a/crunch_global.sql
+++ b/crunch_global.sql
@@ -32,7 +32,7 @@ select
     sum(p_s.impact_score) as impact_score
 from participant p
 join participant_stats p_s on (p_s.participant_api_id = p.api_id)
-join filter f on ((f.name = 'all' and f.dimension_on = 'global') or f.id in (select gpf.filter_id from global_point_filters gpf where gpf.match_api_id = p.match_api_id))
+join filter f on (f.dimension_on = 'global' and (f.name = 'all' or f.id in (select gpf.filter_id from global_point_filters gpf where gpf.match_api_id = p.match_api_id)))
 join series s on (p_s.created_at between s.start and s.end and s.dimension_on = 'global')
 join hero h on (p.hero_id = h.id or h.name = 'all')
 join role r on (p.role_id = r.id or r.name = 'all')
-- 
cgit v1.3.1

