Add include_activity parameter to get_history API

This commit is contained in:
JonnyWong16
2020-10-13 16:26:35 -07:00
parent a120f52e0d
commit 7b936fd664
2 changed files with 11 additions and 5 deletions

View File

@@ -51,15 +51,18 @@ class DataFactory(object):
def __init__(self):
pass
def get_datatables_history(self, kwargs=None, custom_where=None, grouping=None):
def get_datatables_history(self, kwargs=None, custom_where=None, grouping=None, include_activity=None):
data_tables = datatables.DataTables()
if custom_where is None:
custon_where = []
custom_where = []
if grouping is None:
grouping = plexpy.CONFIG.GROUP_HISTORY_TABLES
if include_activity is None:
include_activity = plexpy.CONFIG.HISTORY_TABLE_ACTIVITY
if session.get_session_user_id():
session_user_id = str(session.get_session_user_id())
added = False
@@ -125,7 +128,7 @@ class DataFactory(object):
'NULL AS session_key'
]
if plexpy.CONFIG.HISTORY_TABLE_ACTIVITY:
if include_activity:
table_name_union = 'sessions'
# Very hacky way to match the custom where parameters for the unioned table
custom_where_union = [[c[0].split('.')[-1], c[1]] for c in custom_where]