diff --git a/analytics.py b/analytics.py index 622bd0f..d2bdc03 100644 --- a/analytics.py +++ b/analytics.py @@ -645,17 +645,16 @@ def file_access(): ''' with log_db: cursor = log_db.execute(query, params_for_filter) - rows = cursor.fetchall() + db_rows = cursor.fetchall() # Convert rows to a list of dictionaries and add category - rows = [ - { - 'rel_path': rel_path, - 'access_count': access_count, - 'category': hf.extract_structure_from_string(rel_path)[0] - } - for rel_path, access_count in rows - ] + rows = [] + for rel_path, access_count in db_rows: + rows.append({ + 'rel_path': rel_path, + 'access_count': access_count, + 'category': hf.extract_structure_from_string(rel_path)[0] + }) # Get possible categories from the rows categories = sorted({r['category'] for r in rows if r['category'] is not None})