Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/stats/bin/logprocessor.py

Issue 5901398378020864: Stats processing: don`t count hidden fields for the maximal filter nesting level (Closed)
Patch Set: Created Jan. 27, 2014, 1:05 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/stats/bin/logprocessor.py
===================================================================
--- a/sitescripts/stats/bin/logprocessor.py
+++ b/sitescripts/stats/bin/logprocessor.py
@@ -425,17 +425,27 @@ def parse_record(line, ignored, geo, geo
if "platform" in info:
info["fullPlatform"] = "%s %s" % (info["platform"], info["platformVersion"])
return info
def add_record(info, section, ignore_fields=()):
section["hits"] = section.get("hits", 0) + 1
section["bandwidth"] = section.get("bandwidth", 0) + info["size"]
- if len(ignore_fields) < 2:
+ def is_visible(name):
+ from ..common import fields
+ for field in fields:
+ if field["name"] == name:
+ return "hidden" not in field or not field["hidden"]
Sebastian Noack 2014/01/28 13:30:14 In Python you would do that preferable with one lo
+ return False
+
+ # Allow nesting filters two levels deep but only consider visible fields,
+ # fields that aren't displayed on the web can be nested deeper.
+ filter_level = len(filter(is_visible, ignore_fields))
+ if filter_level < 2:
for field in map(lambda f: f["name"], common.fields):
if field in ignore_fields or field not in info:
continue
value = info[field]
if field not in section:
section[field] = {}
if value not in section[field]:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld