mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Fix broken search on history tables.
Fix bug in history search which wouldn't search for full title. Fix bug where user info pages crashes if user no longer in friends list. Fix bug with query structure, mainly affected incomplete user IP list. User user id on Top user in home stats. Add missing Xbox icon.
This commit is contained in:
parent
30c20b3061
commit
dd90f2e375
7 changed files with 32 additions and 13 deletions
|
@ -146,7 +146,7 @@ class DataFactory(object):
|
|||
'.user ELSE users.friendly_name END) as friendly_name',
|
||||
t1 + '.player as platform',
|
||||
t1 + '.ip_address',
|
||||
t2 + '.full_title as title',
|
||||
t2 + '.full_title as full_title',
|
||||
t1 + '.started',
|
||||
t1 + '.paused_counter',
|
||||
t1 + '.stopped',
|
||||
|
@ -195,7 +195,7 @@ class DataFactory(object):
|
|||
"friendly_name": item['friendly_name'],
|
||||
"platform": item["platform"],
|
||||
"ip_address": item["ip_address"],
|
||||
"title": item["title"],
|
||||
"full_title": item["full_title"],
|
||||
"started": item["started"],
|
||||
"paused_counter": item["paused_counter"],
|
||||
"stopped": item["stopped"],
|
||||
|
@ -259,7 +259,7 @@ class DataFactory(object):
|
|||
|
||||
columns = ['session_history.started as last_seen',
|
||||
'session_history.ip_address as ip_address',
|
||||
'COUNT(session_history.ip_address) as play_count',
|
||||
'COUNT(session_history.id) as play_count',
|
||||
'session_history.player as platform',
|
||||
'session_history_metadata.full_title as last_watched',
|
||||
'session_history.user as user',
|
||||
|
@ -413,9 +413,17 @@ class DataFactory(object):
|
|||
'LIMIT 1'
|
||||
result = monitor_db.select(query, args=[user, user])
|
||||
elif user_id:
|
||||
query = 'SELECT user_id, username, friendly_name, email, thumb, ' \
|
||||
'is_home_user, is_allow_sync, is_restricted FROM users WHERE user_id = ? LIMIT 1'
|
||||
result = monitor_db.select(query, args=[user_id])
|
||||
query = 'SELECT user_id, username, friendly_name, email, ' \
|
||||
'thumb, is_home_user, is_allow_sync, is_restricted ' \
|
||||
'FROM users ' \
|
||||
'WHERE user_id = ? ' \
|
||||
'UNION ALL ' \
|
||||
'SELECT user_id, user, null, null, null, null, null, null ' \
|
||||
'FROM session_history ' \
|
||||
'WHERE user_id = ? ' \
|
||||
'GROUP BY user ' \
|
||||
'LIMIT 1'
|
||||
result = monitor_db.select(query, args=[user_id, user_id])
|
||||
if result:
|
||||
for item in result:
|
||||
if not item['friendly_name']:
|
||||
|
@ -540,7 +548,8 @@ class DataFactory(object):
|
|||
'users.friendly_name end) as friendly_name,' \
|
||||
'COUNT(session_history.id) as total_plays, ' \
|
||||
'MAX(session_history.started) as last_watch, ' \
|
||||
'users.thumb ' \
|
||||
'users.thumb, ' \
|
||||
'users.user_id ' \
|
||||
'FROM session_history ' \
|
||||
'JOIN session_history_metadata ON session_history.id = session_history_metadata.id ' \
|
||||
'LEFT OUTER JOIN users ON session_history.user_id = users.user_id ' \
|
||||
|
@ -560,6 +569,7 @@ class DataFactory(object):
|
|||
user_thumb = item[4]
|
||||
|
||||
row = {'user': item[0],
|
||||
'user_id': item[5],
|
||||
'friendly_name': item[1],
|
||||
'total_plays': item[2],
|
||||
'last_play': item[3],
|
||||
|
|
|
@ -80,9 +80,9 @@ class DataTables(object):
|
|||
% (column_data['column_string'], table_name, join, group_by,
|
||||
where, order)
|
||||
else:
|
||||
query = 'SELECT * FROM (SELECT * FROM (SELECT %s FROM %s %s GROUP BY %s) %s %s) %s' \
|
||||
% (column_data['column_string'], table_name, join, group_by,
|
||||
where, order, custom_where)
|
||||
query = 'SELECT * FROM (SELECT %s FROM %s %s %s GROUP BY %s) %s %s' \
|
||||
% (column_data['column_string'], table_name, join, custom_where, group_by,
|
||||
where, order)
|
||||
else:
|
||||
if custom_where == '':
|
||||
query = 'SELECT %s FROM %s %s %s %s' \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue