Skip to content

Commit

Permalink
Merge pull request #1933 from croneter/fix-ratings
Browse files Browse the repository at this point in the history
Fix ratings being appended to Kodi table instead of being replaced when a video item is updated
  • Loading branch information
croneter authored Feb 25, 2023
2 parents 72ea332 + 984d90c commit ea2e67b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion resources/lib/kodi_db/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ea2e67b

Please sign in to comment.