Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ratings being appended to Kodi table instead of being replaced when a video item is updated #1933

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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