Fix errant tick code

This commit is contained in:
2023-03-13 03:23:12 -04:00
parent 52fc67803a
commit c494779c82
5 changed files with 625 additions and 9 deletions

View File

@ -0,0 +1,17 @@
# Generated by Django 4.1.5 on 2023-03-13 04:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("sports", "0010_rename_run_time_sportevent_run_time_seconds"),
]
operations = [
migrations.RemoveField(
model_name="sport",
name="default_event_run_time",
),
]

View File

@ -34,7 +34,7 @@ class TheSportsDbMixin(TimeStampedModel):
class Sport(TheSportsDbMixin):
default_event_run_time = models.IntegerField(**BNULL)
default_event_run_time_seconds = models.IntegerField(**BNULL)
default_event_type = models.CharField(
max_length=2,
choices=SportEventType.choices,
@ -42,12 +42,12 @@ class Sport(TheSportsDbMixin):
)
@property
def default_event_run_time_ticks(self):
def default_event_run_time_seconds(self):
default_run_time = getattr(
settings, "DEFAULT_EVENT_RUNTIME_SECONDS", 14400
)
if self.default_event_run_time:
default_run_time = self.default_event_run_time
if self.default_event_run_time_seconds:
default_run_time = self.default_event_run_time_seconds
return default_run_time

View File

@ -34,8 +34,7 @@ def lookup_event_from_thesportsdb(event_id: str) -> dict:
"AltName": event.get("strEventAlternate"),
"Start": parse(event.get("strTimestamp")),
"Provider_thesportsdb": event.get("idEvent"),
"RunTime": sport.default_event_run_time,
"RunTimeTicks": sport.default_event_run_time_ticks,
"RunTime": sport.default_event_run_time_seconds,
"Sport": event.get("strSport"),
"Season": event.get("strSeason"),
"LeagueId": event.get("idLeague"),
@ -45,7 +44,6 @@ def lookup_event_from_thesportsdb(event_id: str) -> dict:
"AwayTeamId": event.get("idAwayTeam"),
"AwayTeamName": event.get("strAwayTeam"),
"RoundId": event.get("intRound"),
"PlaybackPositionTicks": None,
"PlaybackPosition": None,
"UtcTimestamp": timezone.now().strftime("%Y-%m-%d %H:%M:%S.%f%z"),
"IsPaused": False,