diff --git a/vrobbler/apps/scrobbles/thesportsdb.py b/vrobbler/apps/scrobbles/thesportsdb.py index 5f1acef..4107a33 100644 --- a/vrobbler/apps/scrobbles/thesportsdb.py +++ b/vrobbler/apps/scrobbles/thesportsdb.py @@ -24,6 +24,7 @@ def lookup_event_from_thesportsdb(event_id: str) -> dict: ) data_dict = { + "EventId": event_id, "ItemType": sport.default_event_type, "Name": event.get('strEvent'), "AltName": event.get('strEventAlternate'), diff --git a/vrobbler/apps/sports/migrations/0008_sportevent_thesportsdb_id.py b/vrobbler/apps/sports/migrations/0008_sportevent_thesportsdb_id.py new file mode 100644 index 0000000..35b3ab5 --- /dev/null +++ b/vrobbler/apps/sports/migrations/0008_sportevent_thesportsdb_id.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.5 on 2023-02-23 15:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sports', '0007_sport_default_event_type'), + ] + + operations = [ + migrations.AddField( + model_name='sportevent', + name='thesportsdb_id', + field=models.CharField(blank=True, max_length=255, null=True), + ), + ] diff --git a/vrobbler/apps/sports/models.py b/vrobbler/apps/sports/models.py index c6f17c3..cde2c92 100644 --- a/vrobbler/apps/sports/models.py +++ b/vrobbler/apps/sports/models.py @@ -15,8 +15,9 @@ BNULL = {"blank": True, "null": True} class SportEventType(models.TextChoices): - UNKNOWN = 'UK', _('Unknown') + UNKNOWN = 'UK', _('Event') GAME = 'GA', _('Game') + RACE = 'RA', _('Race') MATCH = 'MA', _('Match') @@ -221,6 +222,7 @@ class SportEvent(ScrobblableMixin): away_team, _created = Team.objects.get_or_create(**away_team_dict) event_dict = { + "thesportsdb_id": data_dict.get("EventId"), "title": data_dict.get("Name"), "event_type": sport.default_event_type, "home_team": home_team,