From fc75232519dc00a5ae50862707011511f1a1ebe4 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Wed, 16 Sep 2015 11:52:00 -0700 Subject: [PATCH] Change group logic to use user_id instead of user --- plexpy/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 9ffcdece..0f402399 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -611,13 +611,13 @@ def dbcheck(): c_db.execute( 'ALTER TABLE session_history ADD COLUMN reference_id INTEGER DEFAULT 0' ) - # SET reference_id to the first row where (rating_key != previous row OR user != previous row) + # Set reference_id to the first row where (rating_key != previous row OR user_id != previous row) c_db.execute( 'UPDATE session_history ' \ 'SET reference_id = (SELECT (CASE WHEN (SELECT MIN(id) FROM session_history WHERE id > ( \ - SELECT MAX(id) FROM session_history WHERE (rating_key <> t1.rating_key OR user <> t1.user) AND id < t1.id)) IS NULL \ + SELECT MAX(id) FROM session_history WHERE (rating_key <> t1.rating_key OR user_id <> t1.user_id) AND id < t1.id)) IS NULL \ THEN (SELECT MIN(id) FROM session_history) ELSE (SELECT MIN(id) FROM session_history WHERE id > ( \ - SELECT MAX(id) FROM session_history WHERE (rating_key <> t1.rating_key OR user <> t1.user) AND id < t1.id)) END) ' \ + SELECT MAX(id) FROM session_history WHERE (rating_key <> t1.rating_key OR user_id <> t1.user_id) AND id < t1.id)) END) ' \ 'FROM session_history AS t1 ' \ 'WHERE t1.id = session_history.id) ' )