fix messed up analytics
This commit is contained in:
parent
9b2c79b039
commit
fb15977924
@ -253,7 +253,7 @@ def dashboard():
|
|||||||
dict(bucket=r[0], count=r[1]) for r in distinct_device_data_rows
|
dict(bucket=r[0], count=r[1]) for r in distinct_device_data_rows
|
||||||
]
|
]
|
||||||
|
|
||||||
# 3. session['timeframe']-based aggregation
|
# 3. Download trend
|
||||||
# We'll group by hour if "today", by day if "7days"/"30days", by month if "365days".
|
# We'll group by hour if "today", by day if "7days"/"30days", by month if "365days".
|
||||||
if session['timeframe'] == 'last24hours':
|
if session['timeframe'] == 'last24hours':
|
||||||
# Hour: substr(timestamp, 12, 2) -> HH
|
# Hour: substr(timestamp, 12, 2) -> HH
|
||||||
@ -343,7 +343,7 @@ def dashboard():
|
|||||||
SELECT city, country, COUNT(*) as count
|
SELECT city, country, COUNT(*) as count
|
||||||
FROM file_access_log
|
FROM file_access_log
|
||||||
WHERE timestamp >= ? {filetype_filter_sql}
|
WHERE timestamp >= ? {filetype_filter_sql}
|
||||||
GROUP BY city
|
GROUP BY city, country
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
'''
|
'''
|
||||||
with log_db:
|
with log_db:
|
||||||
@ -397,7 +397,7 @@ def dashboard():
|
|||||||
# 8. Process location data
|
# 8. Process location data
|
||||||
location_data_dict = {}
|
location_data_dict = {}
|
||||||
for (city, country, cnt) in locations:
|
for (city, country, cnt) in locations:
|
||||||
key = (country, city)
|
key = (city, country)
|
||||||
location_data_dict[key] = location_data_dict.get(key, 0) + cnt
|
location_data_dict[key] = location_data_dict.get(key, 0) + cnt
|
||||||
|
|
||||||
location_data = [
|
location_data = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user