瀏覽代碼

Clean up rounds in sports

Colin Powell 2 年之前
父節點
當前提交
8122179c7a
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      vrobbler/apps/sports/models.py

+ 7 - 2
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