From 29cd2f8015cf5a4f009ee9dec805c6dd730a55e8 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sat, 21 Mar 2026 11:37:18 -0400 Subject: [PATCH] [people] Fix scrobble count on sqlite --- vrobbler/apps/people/models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vrobbler/apps/people/models.py b/vrobbler/apps/people/models.py index 3c54f0a..969a2d3 100644 --- a/vrobbler/apps/people/models.py +++ b/vrobbler/apps/people/models.py @@ -30,9 +30,11 @@ class Person(TimeStampedModel): def update_scrobble_count(self): from scrobbles.models import Scrobble - count = Scrobble.objects.filter( - user=self.created_by, - log__with_people_ids__contains=self.id, - ).count() + count = 0 + for scrobble in Scrobble.objects.filter(user=self.created_by): + if scrobble.log and isinstance(scrobble.log, dict): + person_ids = scrobble.log.get("with_people_ids", []) + if self.id in person_ids: + count += 1 self.scrobble_count = count self.save(update_fields=["scrobble_count"])