From 60878ed12e0c42d8eaa23aedefcd439fdf56b37b Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Fri, 11 Sep 2015 15:40:24 -0700 Subject: [PATCH] Add table name session_history to paused_counter in watch stats query --- plexpy/datafactory.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py index 8f33b2a8..df6d3686 100644 --- a/plexpy/datafactory.py +++ b/plexpy/datafactory.py @@ -155,7 +155,8 @@ class DataFactory(object): 'COUNT(session_history_metadata.grandparent_title) as total_plays, ' \ 'SUM(case when session_history.stopped > 0 ' \ 'then (session_history.stopped - session_history.started) ' \ - ' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration, ' \ + ' - (case when session_history.paused_counter is NULL then 0 else session_history.paused_counter end) ' \ + 'else 0 end) as total_duration, ' \ 'session_history_metadata.grandparent_rating_key, ' \ 'MAX(session_history.started) as last_watch,' \ 'session_history_metadata.grandparent_thumb ' \ @@ -242,7 +243,8 @@ class DataFactory(object): 'COUNT(session_history_metadata.full_title) as total_plays, ' \ 'SUM(case when session_history.stopped > 0 ' \ 'then (session_history.stopped - session_history.started) ' \ - ' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration, ' \ + ' - (case when session_history.paused_counter is NULL then 0 else session_history.paused_counter end) ' \ + 'else 0 end) as total_duration, ' \ 'session_history_metadata.rating_key, ' \ 'MAX(session_history.started) as last_watch,' \ 'session_history_metadata.thumb ' \ @@ -330,7 +332,8 @@ class DataFactory(object): 'COUNT(session_history.id) as total_plays, ' \ 'SUM(case when session_history.stopped > 0 ' \ 'then (session_history.stopped - session_history.started) ' \ - ' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration, ' \ + ' - (case when session_history.paused_counter is NULL then 0 else session_history.paused_counter end) ' \ + 'else 0 end) as total_duration, ' \ 'MAX(session_history.started) as last_watch, ' \ 'users.custom_avatar_url as thumb, ' \ 'users.user_id ' \ @@ -381,7 +384,8 @@ class DataFactory(object): 'COUNT(session_history.id) as total_plays, ' \ 'SUM(case when session_history.stopped > 0 ' \ 'then (session_history.stopped - session_history.started) ' \ - ' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration, ' \ + ' - (case when session_history.paused_counter is NULL then 0 else session_history.paused_counter end) ' \ + 'else 0 end) as total_duration, ' \ 'MAX(session_history.started) as last_watch ' \ 'FROM session_history ' \ 'WHERE datetime(session_history.stopped, "unixepoch", "localtime") ' \