avoid reusing of variable
This commit is contained in:
parent
f3b44d1d5a
commit
3c86456a58
17
analytics.py
17
analytics.py
@ -645,17 +645,16 @@ def file_access():
|
|||||||
'''
|
'''
|
||||||
with log_db:
|
with log_db:
|
||||||
cursor = log_db.execute(query, params_for_filter)
|
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
|
# Convert rows to a list of dictionaries and add category
|
||||||
rows = [
|
rows = []
|
||||||
{
|
for rel_path, access_count in db_rows:
|
||||||
'rel_path': rel_path,
|
rows.append({
|
||||||
'access_count': access_count,
|
'rel_path': rel_path,
|
||||||
'category': hf.extract_structure_from_string(rel_path)[0]
|
'access_count': access_count,
|
||||||
}
|
'category': hf.extract_structure_from_string(rel_path)[0]
|
||||||
for rel_path, access_count in rows
|
})
|
||||||
]
|
|
||||||
|
|
||||||
# Get possible categories from the rows
|
# Get possible categories from the rows
|
||||||
categories = sorted({r['category'] for r in rows if r['category'] is not None})
|
categories = sorted({r['category'] for r in rows if r['category'] is not None})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user