QChris has uploaded a new change for review.
https://gerrit.wikimedia.org/r/172234
Change subject: Add header line to CSVs for projectcounts aggregation
......................................................................
Add header line to CSVs for projectcounts aggregation
Change-Id: I59ee3c235677d4c5538230fd591341e2b32b970f
---
M aggregator/projectcounts.py
M tests/test_projectcounts.py
2 files changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/analytics/aggregator
refs/changes/34/172234/1
diff --git a/aggregator/projectcounts.py b/aggregator/projectcounts.py
index 4642bb1..badad07 100644
--- a/aggregator/projectcounts.py
+++ b/aggregator/projectcounts.py
@@ -155,7 +155,10 @@
if date_str in csv_data:
raise RuntimeError(
"CSV contains the date '%s' twice" % (date_str))
- csv_data[date_str] = line.strip() + '\n'
+
+ if date_str != 'Date':
+ # No header line
+ csv_data[date_str] = line.strip() + '\n'
for date in util.generate_dates(first_date, last_date):
date_str = date.isoformat()
@@ -188,6 +191,7 @@
count_zero)
with open(csv_file_abs, 'w') as csv_file:
+ csv_file.write('Date,Desktop site,Mobile site,Zero site\n')
csv_file.writelines(sorted(csv_data.itervalues()))
diff --git a/tests/test_projectcounts.py b/tests/test_projectcounts.py
index 3f347b0..c48c5d6 100644
--- a/tests/test_projectcounts.py
+++ b/tests/test_projectcounts.py
@@ -76,6 +76,7 @@
file.write('%s,123456789,12345678,1234567\n' % (date_str))
def assert_file_content_equals(self, actual_file_abs, expected_lines):
+ expected_lines.insert(0, 'Date,Desktop site,Mobile site,Zero site')
with open(actual_file_abs, 'r') as file:
for expected_line in expected_lines:
try:
--
To view, visit https://gerrit.wikimedia.org/r/172234
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59ee3c235677d4c5538230fd591341e2b32b970f
Gerrit-PatchSet: 1
Gerrit-Project: analytics/aggregator
Gerrit-Branch: master
Gerrit-Owner: QChris <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits