Fix redundant tick field
This commit is contained in:
@ -0,0 +1,46 @@
|
||||
# Generated by Django 4.1.5 on 2023-03-12 01:01
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("sports", "0008_sportevent_thesportsdb_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="sport",
|
||||
name="default_event_type",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("UK", "Event"),
|
||||
("GA", "Game"),
|
||||
("RA", "Race"),
|
||||
("MA", "Match"),
|
||||
],
|
||||
default="UK",
|
||||
max_length=2,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="sportevent",
|
||||
name="event_type",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("UK", "Event"),
|
||||
("GA", "Game"),
|
||||
("RA", "Race"),
|
||||
("MA", "Match"),
|
||||
],
|
||||
default="UK",
|
||||
max_length=2,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="sportevent",
|
||||
name="run_time",
|
||||
field=models.IntegerField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.1.5 on 2023-03-12 01:21
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("sports", "0009_alter_sport_default_event_type_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="sportevent",
|
||||
old_name="run_time",
|
||||
new_name="run_time_seconds",
|
||||
),
|
||||
]
|
||||
@ -41,9 +41,6 @@ class Sport(TheSportsDbMixin):
|
||||
default=SportEventType.UNKNOWN,
|
||||
)
|
||||
|
||||
# TODO Add these to the default run_time for Football
|
||||
# run_time_seconds = 11700
|
||||
# run_time_ticks = run_time_seconds * 1000
|
||||
@property
|
||||
def default_event_run_time_ticks(self):
|
||||
default_run_time = getattr(
|
||||
@ -51,7 +48,7 @@ class Sport(TheSportsDbMixin):
|
||||
)
|
||||
if self.default_event_run_time:
|
||||
default_run_time = self.default_event_run_time
|
||||
return default_run_time * 1000
|
||||
return default_run_time
|
||||
|
||||
|
||||
class League(TheSportsDbMixin):
|
||||
@ -231,8 +228,7 @@ class SportEvent(ScrobblableMixin):
|
||||
"player_two": player_two,
|
||||
"start": data_dict["Start"],
|
||||
"round": round,
|
||||
"run_time_ticks": data_dict.get("RunTimeTicks"),
|
||||
"run_time": data_dict.get("RunTime", ""),
|
||||
"run_time_seconds": data_dict.get("RunTime", 0),
|
||||
}
|
||||
event, _created = cls.objects.get_or_create(**event_dict)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user