limit folder_today to actual available folder
This commit is contained in:
parent
b518b61a64
commit
2c340ae2df
26
analytics.py
26
analytics.py
@ -158,6 +158,25 @@ def log_file_access(rel_path, filesize, mime, ip_address, user_agent, device_id,
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def return_folder_today():
|
||||||
|
"""
|
||||||
|
Return only those folder_today entries whose first segment
|
||||||
|
(up to the first '/') is in session['folders'].keys().
|
||||||
|
"""
|
||||||
|
valid_keys = set(session.get('folders', {}).keys())
|
||||||
|
|
||||||
|
filtered = []
|
||||||
|
for entry in folder_today:
|
||||||
|
# get the part before the first slash
|
||||||
|
top_level = entry['rel_path'].split('/', 1)[0]
|
||||||
|
|
||||||
|
# include only if this segment is one of the session keys
|
||||||
|
if top_level in valid_keys:
|
||||||
|
filtered.append(entry)
|
||||||
|
|
||||||
|
return filtered
|
||||||
|
|
||||||
|
|
||||||
def return_file_access():
|
def return_file_access():
|
||||||
"""Return recent file access logs from memory (the last 10 minutes)."""
|
"""Return recent file access logs from memory (the last 10 minutes)."""
|
||||||
global file_access_temp
|
global file_access_temp
|
||||||
@ -174,13 +193,6 @@ def return_file_access():
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def return_folder_today():
|
|
||||||
global folder_today
|
|
||||||
if folder_today:
|
|
||||||
return folder_today
|
|
||||||
else:
|
|
||||||
return []
|
|
||||||
|
|
||||||
def songs_dashboard():
|
def songs_dashboard():
|
||||||
# — SESSION & PARAM HANDLING (unchanged) —
|
# — SESSION & PARAM HANDLING (unchanged) —
|
||||||
if 'songs_dashboard_timeframe' not in session:
|
if 'songs_dashboard_timeframe' not in session:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user