From fb159779241ba419eabbe4416b72bb5b6d999760 Mon Sep 17 00:00:00 2001 From: lelo Date: Sat, 5 Apr 2025 20:06:56 +0000 Subject: [PATCH] fix messed up analytics --- analytics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/analytics.py b/analytics.py index b42502a..fa28f80 100644 --- a/analytics.py +++ b/analytics.py @@ -253,7 +253,7 @@ def dashboard(): 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". if session['timeframe'] == 'last24hours': # Hour: substr(timestamp, 12, 2) -> HH @@ -343,7 +343,7 @@ def dashboard(): SELECT city, country, COUNT(*) as count FROM file_access_log WHERE timestamp >= ? {filetype_filter_sql} - GROUP BY city + GROUP BY city, country ORDER BY count DESC ''' with log_db: @@ -397,7 +397,7 @@ def dashboard(): # 8. Process location data location_data_dict = {} 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 = [