From 5050ca981069283568eb468753dca2cf7608bc88 Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Thu, 18 May 2017 19:54:07 +0200
Subject: calculate fame only for the last 7d

---
 crunch_team.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'crunch_team.sql')

diff --git a/crunch_team.sql b/crunch_team.sql
index 3d55e25..82e3c6e 100644
--- a/crunch_team.sql
+++ b/crunch_team.sql
@@ -32,6 +32,7 @@ JOIN (
         JOIN roster r ON p.roster_api_id = r.api_id
         JOIN `match` m ON r.match_api_id = m.api_id
         WHERE t.id = :team_id
+        AND p.created_at > DATE_SUB(CURDATE(), INTERVAL 7 DAY)
         GROUP BY t.id, m.api_id, r.id
     ) AS cnt_by_m
     JOIN participant p ON p.match_api_id = cnt_by_m.m_api_id
-- 
cgit v1.3.1

