Fix deleted libraries adding to watch statistics

* Fixes #1456
This commit is contained in:
JonnyWong16 2021-07-01 16:31:50 -07:00
parent f7fc16a1d8
commit c6548c80b3
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 3 additions and 2 deletions

View file

@ -659,7 +659,8 @@ class DataFactory(object):
' FROM session_history ' \ ' FROM session_history ' \
' WHERE session_history.stopped >= %s ' \ ' WHERE session_history.stopped >= %s ' \
' GROUP BY %s) AS sh ' \ ' GROUP BY %s) AS sh ' \
'LEFT OUTER JOIN library_sections AS ls ON sh.section_id = ls.section_id ' \ 'LEFT OUTER JOIN (SELECT * FROM library_sections WHERE deleted_section = 0) ' \
' AS ls ON sh.section_id = ls.section_id ' \
'GROUP BY sh.section_id ' \ 'GROUP BY sh.section_id ' \
'ORDER BY %s DESC, sh.started DESC ' \ 'ORDER BY %s DESC, sh.started DESC ' \
'LIMIT %s OFFSET %s ' % (timestamp, group_by, sort_type, stats_count, stats_start) 'LIMIT %s OFFSET %s ' % (timestamp, group_by, sort_type, stats_count, stats_start)

View file

@ -1099,7 +1099,7 @@ class Libraries(object):
if row_ids and row_ids is not None: if row_ids and row_ids is not None:
row_ids = list(map(helpers.cast_to_int, row_ids.split(','))) row_ids = list(map(helpers.cast_to_int, row_ids.split(',')))
# Get the user_ids corresponding to the row_ids # Get the section_ids corresponding to the row_ids
result = monitor_db.select('SELECT server_id, section_id FROM library_sections ' result = monitor_db.select('SELECT server_id, section_id FROM library_sections '
'WHERE id IN ({})'.format(','.join(['?'] * len(row_ids))), row_ids) 'WHERE id IN ({})'.format(','.join(['?'] * len(row_ids))), row_ids)