[people] Fix if person_ids is None
This commit is contained in:
@ -33,8 +33,8 @@ class Person(TimeStampedModel):
|
|||||||
count = 0
|
count = 0
|
||||||
for scrobble in Scrobble.objects.filter(user=self.created_by):
|
for scrobble in Scrobble.objects.filter(user=self.created_by):
|
||||||
if scrobble.log and isinstance(scrobble.log, dict):
|
if scrobble.log and isinstance(scrobble.log, dict):
|
||||||
person_ids = scrobble.log.get("with_people_ids", [])
|
person_ids = scrobble.log.get("with_people_ids") or []
|
||||||
if self.id in person_ids:
|
if person_ids and self.id in person_ids:
|
||||||
count += 1
|
count += 1
|
||||||
self.scrobble_count = count
|
self.scrobble_count = count
|
||||||
self.save(update_fields=["scrobble_count"])
|
self.save(update_fields=["scrobble_count"])
|
||||||
|
|||||||
Reference in New Issue
Block a user