AndyRussG has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176214

Change subject: Allow campaign and banner params on hide URLs
......................................................................

Allow campaign and banner params on hide URLs

Change-Id: I5da831cec161286ace9895c56620c041b5305030
---
M fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
1 file changed, 21 insertions(+), 15 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools/DjangoBannerStats 
refs/changes/14/176214/1

diff --git 
a/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py 
b/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
index 0c0ba08..95af2bd 100644
--- 
a/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
+++ 
b/fundraiser/analytics/management/commands/LoadBannerImpressions2Aggregate.py
@@ -300,31 +300,37 @@
 
                         country = lookup_country(country)
 
+                        if "result" in qs:
+                            result = qs["result"][0]
+                        else:
+                            result = None
+
                         if banner == "" or campaign == "" or project is None:
                             if "BannerController" in l:
                                 # we really don't care about these, so there 
is no need to log them as errors
                                 results["impression"]["ignored"] += 1
                                 
results["impression"]["ignore_because"]["file"] += 1
                                 continue
-                            if "result" in qs and qs["result"][0] == "hide":
-                                results["impression"]["ignored"] += 1
 
-                                if "reason" in qs:
+                        if result == "hide":
+                            results["impression"]["ignored"] += 1
 
-                                    # Switch "cookie" to "hidecookie" and 
"empty" to "hideempty"
-                                    # for consistency with legacy reasons in 
the database
-                                    reason = qs["reason"][0]
-                                    if reason == "cookie":
-                                        reason = "hidecookie"
-                                    if reason == "empty":
-                                        reason = "hideempty"
+                            if "reason" in qs:
 
-                                    if reason in 
results["impression"]["ignore_because"]:
-                                        
results["impression"]["ignore_because"][reason] += 1
-                                    else:
-                                        
results["impression"]["ignore_because"]["other"] += 1
+                                # Switch "cookie" to "hidecookie" and "empty" 
to "hideempty"
+                                # for consistency with legacy reasons in the 
database
+                                reason = qs["reason"][0]
+                                if reason == "cookie":
+                                    reason = "hidecookie"
+                                if reason == "empty":
+                                    reason = "hideempty"
 
-                                continue
+                                if reason in 
results["impression"]["ignore_because"]:
+                                    
results["impression"]["ignore_because"][reason] += 1
+                                else:
+                                    
results["impression"]["ignore_because"]["other"] += 1
+
+                            continue
 
                             results["impression"]["error"] += 1
                             if self.verbose:

-- 
To view, visit https://gerrit.wikimedia.org/r/176214
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5da831cec161286ace9895c56620c041b5305030
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools/DjangoBannerStats
Gerrit-Branch: master
Gerrit-Owner: AndyRussG <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to