Index: sitescripts/stats/bin/logprocessor.py |
=================================================================== |
--- a/sitescripts/stats/bin/logprocessor.py |
+++ b/sitescripts/stats/bin/logprocessor.py |
@@ -210,41 +210,54 @@ def parse_downloader_query(info): |
(info["addonName"] == "adblockplus" and info["addonVersion"] == "2.3.1") or |
(info["addonName"] in ("adblockpluschrome", "adblockplusopera") and info["addonVersion"] == "1.5.2") |
): |
# Broken notification version number in these releases, treat like unknown |
last_version = "unknown" |
if last_version == "unknown": |
info["downloadInterval"] = "unknown" |
+ info["previousDownload"] = "unknown" |
elif last_version == "0": |
info["downloadInterval"] = "unknown" |
+ info["previousDownload"] = "unknown" |
info["firstDownload"] = True |
else: |
try: |
last_update = parse_lastversion(last_version) |
diff = info["time"] - last_update |
if diff.days >= 365: |
info["downloadInterval"] = "%i year(s)" % (diff.days / 365) |
elif diff.days >= 30: |
info["downloadInterval"] = "%i month(s)" % (diff.days / 30) |
elif diff.days >= 1: |
info["downloadInterval"] = "%i day(s)" % diff.days |
else: |
info["downloadInterval"] = "%i hour(s)" % (diff.seconds / 3600) |
+ diffdays = (info["time"].date() - last_update.date()).days |
+ if diffdays == 0: |
+ info["previousDownload"] = "same day" |
+ elif diffdays < 30: |
+ info["previousDownload"] = "%i day(s)" % diffdays |
+ elif diffdays < 365: |
+ info["previousDownload"] = "%i month(s)" % (diffdays / 30) |
+ else: |
+ info["previousDownload"] = "%i year(s)" % (diffdays / 365) |
+ |
if last_update.year != info["time"].year or last_update.month != info["time"].month: |
info["firstInMonth"] = info["firstInDay"] = True |
elif last_update.day != info["time"].day: |
info["firstInDay"] = True |
if get_week(last_update) != get_week(info["time"]): |
info["firstInWeek"] = True |
except ValueError: |
info["downloadInterval"] = "unknown" |
+ info["previousDownload"] = "unknown" |
pass |
def parse_addon_name(file): |
if "/" in file: |
return file.split("/")[-2] |
else: |
return None |