From ef63de8c47f491fca47ef5edc78f3d9e488bd2c3 Mon Sep 17 00:00:00 2001 From: Thaddee Tyl Date: Fri, 20 Jun 2014 11:53:32 +0200 Subject: [PATCH] Analytics: count flat badges requests. Related to issue #185. --- server.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 967e8b3822529c..c513ae81c52f7f 100644 --- a/server.js +++ b/server.js @@ -61,9 +61,11 @@ function analyticsAutoLoad() { } // In case something happens on the 36th. analytics.vendorMonthly = new Array(36); - analytics.rawMonthly = new Array(36); resetMonthlyAnalytics(analytics.vendorMonthly); + analytics.rawMonthly = new Array(36); resetMonthlyAnalytics(analytics.rawMonthly); + analytics.rawFlatMonthly = new Array(36); + resetMonthlyAnalytics(analytics.rawFlatMonthly); }); } else { // Not using Redis. @@ -72,9 +74,11 @@ function analyticsAutoLoad() { } catch(e) { // In case something happens on the 36th. analytics.vendorMonthly = new Array(36); - analytics.rawMonthly = new Array(36); resetMonthlyAnalytics(analytics.vendorMonthly); + analytics.rawMonthly = new Array(36); resetMonthlyAnalytics(analytics.rawMonthly); + analytics.rawFlatMonthly = new Array(36); + resetMonthlyAnalytics(analytics.rawFlatMonthly); } } } @@ -122,6 +126,9 @@ function cache(f) { // Cache management - no cache, so it won't be cached by GitHub's CDN. ask.res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); incrMonthlyAnalytics(analytics.vendorMonthly); + if (data.style === 'flat') { + incrMonthlyAnalytics(analytics.rawFlatMonthly); + } var cacheIndex = match[0] + '?label=' + data.label + '&style=' + data.style; // Should we return the data right away?