Add quali_date + has_sprint fields to race
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 15s
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 15s
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from sqlalchemy import DateTime, Integer, String
|
||||
from sqlalchemy import Boolean, DateTime, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from formula10 import db
|
||||
@ -19,4 +19,6 @@ class DbRace(db.Model):
|
||||
name: Mapped[str] = mapped_column(String(64), nullable=False, unique=True)
|
||||
number: Mapped[int] = mapped_column(Integer, nullable=False, unique=True)
|
||||
date: Mapped[datetime] = mapped_column(DateTime, nullable=False, unique=True)
|
||||
pxx: Mapped[int] = mapped_column(Integer, nullable=False) # This is the place to guess
|
||||
pxx: Mapped[int] = mapped_column(Integer, nullable=False) # This is the place to guess
|
||||
quali_date: Mapped[datetime] = mapped_column(DateTime, nullable=False, unique=True)
|
||||
has_sprint: Mapped[bool] = mapped_column(Boolean, nullable=False)
|
@ -13,6 +13,8 @@ class Race():
|
||||
race.number = db_race.number
|
||||
race.date = db_race.date
|
||||
race.place_to_guess = db_race.pxx
|
||||
race.quali_date = db_race.quali_date
|
||||
race.has_sprint = db_race.has_sprint
|
||||
return race
|
||||
|
||||
def to_db_race(self) -> DbRace:
|
||||
@ -21,6 +23,8 @@ class Race():
|
||||
db_race.number = self.number
|
||||
db_race.date = self.date
|
||||
db_race.pxx = self.place_to_guess
|
||||
db_race.quali_date = self.date
|
||||
db_race.has_sprint = self.has_sprint
|
||||
return db_race
|
||||
|
||||
def __eq__(self, __value: object) -> bool:
|
||||
@ -37,6 +41,8 @@ class Race():
|
||||
number: int
|
||||
date: datetime
|
||||
place_to_guess: int
|
||||
quali_date: datetime
|
||||
has_sprint: bool
|
||||
|
||||
@property
|
||||
def name_sanitized(self) -> str:
|
||||
|
Reference in New Issue
Block a user