From 984d90c72811eeb1ee8e366279e43a3208180a3c Mon Sep 17 00:00:00 2001 From: Croneter <10926395-Croneter@users.noreply.gitlab.com> Date: Sat, 25 Feb 2023 15:42:27 +0100 Subject: [PATCH] Fix ratings being appended to Kodi table instead of being replaced when a video item is updated --- resources/lib/kodi_db/video.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/lib/kodi_db/video.py b/resources/lib/kodi_db/video.py index 77fb62689..95763375e 100644 --- a/resources/lib/kodi_db/video.py +++ b/resources/lib/kodi_db/video.py @@ -864,8 +864,13 @@ def update_ratings(self, *args): """ Feed with media_id, media_type, rating_type, rating, votes, rating_id """ + # Delete existing entries first self.cursor.execute(''' - INSERT OR REPLACE INTO + DELETE FROM rating WHERE media_id = ? AND media_type = ? + ''', (args[0], args[1])) + # Then add the new one + self.cursor.execute(''' + INSERT INTO rating(media_id, media_type, rating_type, rating, votes) VALUES (?, ?, ?, ?, ?) ''', (args))