diff --git a/analytics.py b/analytics.py index c569e28..eba9f28 100644 --- a/analytics.py +++ b/analytics.py @@ -145,13 +145,12 @@ def dashboard(): now = datetime.now() - # Determine which file type we're filtering by. + # default filetype if not found filetype = 'other' - # Some simplistic sets to decide how we match the MIME type - audio_list = ['mp3', 'wav', 'audio'] - image_list = ['jpg', 'jpeg', 'image', 'photo'] - video_list = ['mp4', 'mov', 'wmv', 'avi'] + audio_list = ['mp3', 'wav', 'ton', 'audio'] + image_list = ['jpg', 'jpeg', 'image', 'photo', 'bild', 'foto'] + video_list = ['mp4', 'mov', 'wmv', 'avi', 'film', 'video'] if session['filetype'].lower() in audio_list: filetype = 'audio/' @@ -292,9 +291,9 @@ def dashboard(): dict(bucket=r[0], count=r[1]) for r in timeframe_data_rows ] - # 4. User agent distribution + # 4. User agent distribution: Count user_agent once per device_id query = f''' - SELECT user_agent, COUNT(*) AS count + SELECT user_agent, COUNT(DISTINCT device_id) AS count FROM file_access_log WHERE timestamp >= ? {filetype_filter_sql} GROUP BY user_agent diff --git a/templates/connections.html b/templates/connections.html index a41dc15..6cc6b0d 100644 --- a/templates/connections.html +++ b/templates/connections.html @@ -1,7 +1,7 @@
- +| Timestamp | IP Address | diff --git a/templates/dashboard.html b/templates/dashboard.html index 9b9217f..e22f2a5 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -11,375 +11,382 @@ margin: 0; padding: 0; } - /* Use full width */ .container-fluid { height: 100%; display: flex; flex-direction: column; } - .card { margin-bottom: 20px; } + .card { + margin-bottom: 1.5rem; + } - -
|---|