From 8122179c7a01d11f5baeb8848d35e40f8e169d92 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 14 Mar 2023 17:00:47 -0400 Subject: [PATCH] Clean up rounds in sports --- vrobbler/apps/sports/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vrobbler/apps/sports/models.py b/vrobbler/apps/sports/models.py index 53a3c95..e262518 100644 --- a/vrobbler/apps/sports/models.py +++ b/vrobbler/apps/sports/models.py @@ -81,7 +81,10 @@ class Round(TheSportsDbMixin): season = models.ForeignKey(Season, on_delete=models.DO_NOTHING, **BNULL) def __str__(self): - return f"{self.name} of {self.season}" + value = f"{self.name} of {self.season}" + if not self.name: + value = f"{self.thesportsdb_id} of {self.season}" + return value class SportEvent(ScrobblableMixin): @@ -174,7 +177,9 @@ class SportEvent(ScrobblableMixin): # Find or create our Round rid = data_dict.get("RoundId") round, r_created = Round.objects.get_or_create( - thesportsdb_id=rid, season=season + thesportsdb_id=rid, + season=season, + name=rid, ) if r_created: round.season = season