Clean up rounds in sports
This commit is contained in:
@ -81,7 +81,10 @@ class Round(TheSportsDbMixin):
|
|||||||
season = models.ForeignKey(Season, on_delete=models.DO_NOTHING, **BNULL)
|
season = models.ForeignKey(Season, on_delete=models.DO_NOTHING, **BNULL)
|
||||||
|
|
||||||
def __str__(self):
|
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):
|
class SportEvent(ScrobblableMixin):
|
||||||
@ -174,7 +177,9 @@ class SportEvent(ScrobblableMixin):
|
|||||||
# Find or create our Round
|
# Find or create our Round
|
||||||
rid = data_dict.get("RoundId")
|
rid = data_dict.get("RoundId")
|
||||||
round, r_created = Round.objects.get_or_create(
|
round, r_created = Round.objects.get_or_create(
|
||||||
thesportsdb_id=rid, season=season
|
thesportsdb_id=rid,
|
||||||
|
season=season,
|
||||||
|
name=rid,
|
||||||
)
|
)
|
||||||
if r_created:
|
if r_created:
|
||||||
round.season = season
|
round.season = season
|
||||||
|
|||||||
Reference in New Issue
Block a user