mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Fix grouping on history table
This commit is contained in:
parent
19f3286a82
commit
6ec6c69dba
2 changed files with 10 additions and 8 deletions
|
@ -33,12 +33,15 @@ class DataFactory(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_datatables_history(self, kwargs=None, custom_where=None, grouping=0, watched_percent=85):
|
def get_datatables_history(self, kwargs=None, custom_where=None, grouping=None):
|
||||||
data_tables = datatables.DataTables()
|
data_tables = datatables.DataTables()
|
||||||
|
|
||||||
if custom_where is None:
|
if custom_where is None:
|
||||||
custon_where = []
|
custon_where = []
|
||||||
|
|
||||||
|
if grouping is None:
|
||||||
|
grouping = plexpy.CONFIG.GROUP_HISTORY_TABLES
|
||||||
|
|
||||||
if session.get_session_user_id():
|
if session.get_session_user_id():
|
||||||
session_user_id = str(session.get_session_user_id())
|
session_user_id = str(session.get_session_user_id())
|
||||||
added = False
|
added = False
|
||||||
|
@ -119,6 +122,7 @@ class DataFactory(object):
|
||||||
|
|
||||||
filter_duration = 0
|
filter_duration = 0
|
||||||
total_duration = self.get_total_duration(custom_where=custom_where)
|
total_duration = self.get_total_duration(custom_where=custom_where)
|
||||||
|
watched_percent = plexpy.CONFIG.NOTIFY_WATCHED_PERCENT
|
||||||
|
|
||||||
rows = []
|
rows = []
|
||||||
for item in history:
|
for item in history:
|
||||||
|
|
|
@ -1265,7 +1265,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_history(self, user=None, user_id=None, grouping=0, **kwargs):
|
def get_history(self, user=None, user_id=None, grouping=None, **kwargs):
|
||||||
""" Get the PlexPy history.
|
""" Get the PlexPy history.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -1350,12 +1350,10 @@ class WebInterface(object):
|
||||||
("watched_status", False, False)]
|
("watched_status", False, False)]
|
||||||
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "date")
|
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "date")
|
||||||
|
|
||||||
if not grouping or grouping == 'false':
|
if grouping and str(grouping).isdigit():
|
||||||
|
grouping = int(grouping)
|
||||||
|
elif grouping == 'false':
|
||||||
grouping = 0
|
grouping = 0
|
||||||
else:
|
|
||||||
grouping = plexpy.CONFIG.GROUP_HISTORY_TABLES
|
|
||||||
|
|
||||||
watched_percent = plexpy.CONFIG.NOTIFY_WATCHED_PERCENT
|
|
||||||
|
|
||||||
custom_where = []
|
custom_where = []
|
||||||
if user_id:
|
if user_id:
|
||||||
|
@ -1390,7 +1388,7 @@ class WebInterface(object):
|
||||||
custom_where.append(['session_history_media_info.transcode_decision', transcode_decision])
|
custom_where.append(['session_history_media_info.transcode_decision', transcode_decision])
|
||||||
|
|
||||||
data_factory = datafactory.DataFactory()
|
data_factory = datafactory.DataFactory()
|
||||||
history = data_factory.get_datatables_history(kwargs=kwargs, custom_where=custom_where, grouping=grouping, watched_percent=watched_percent)
|
history = data_factory.get_datatables_history(kwargs=kwargs, custom_where=custom_where, grouping=grouping)
|
||||||
|
|
||||||
return history
|
return history
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue