Preparation: add ticket type
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from pydantic.dataclasses import dataclass
|
from pydantic.dataclasses import dataclass
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Scan:
|
class Scan:
|
||||||
|
id: int
|
||||||
date: datetime
|
date: datetime
|
||||||
event_name: str
|
event_name: str
|
||||||
|
|
||||||
|
|||||||
21
src/beaky/datamodels/ticket.py
Normal file
21
src/beaky/datamodels/ticket.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from abc import ABC
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
from pydantic.dataclasses import dataclass
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
|
|
||||||
|
class TicketType(str, Enum):
|
||||||
|
WIN_DRAW_LOSE = "win_draw_lose"
|
||||||
|
# postup?
|
||||||
|
WIN_DRAW_LOSE_DOUBLE = "win_draw_lose_double"
|
||||||
|
WIN_LOSE = "win_lose"
|
||||||
|
BOTH_TEAM_SCORED = "both_team_scored"
|
||||||
|
GOAL_AMOUNT = "goal_amount"
|
||||||
|
...
|
||||||
|
|
||||||
|
# Classes that inherit from this are defined in resolution file, so the deciding function can be used
|
||||||
|
@dataclass
|
||||||
|
class Ticket(ABC):
|
||||||
|
ticketType: TicketType
|
||||||
|
decidingFunction: Callable
|
||||||
@@ -5,7 +5,7 @@ from openpyxl import load_workbook
|
|||||||
from pydantic.dataclasses import dataclass
|
from pydantic.dataclasses import dataclass
|
||||||
|
|
||||||
from beaky.config import Config
|
from beaky.config import Config
|
||||||
from beaky.datamodels.scan import Scan
|
from beaky.datamodels.ticket import Scan
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -27,13 +27,6 @@ class Scanner:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Link:
|
class Link:
|
||||||
"""Represents a single link row from an Excel sheet.
|
|
||||||
|
|
||||||
Attributes:
|
|
||||||
id: identifier from the sheet (kept as string)
|
|
||||||
url: link to the web page
|
|
||||||
date: optional creation date (datetime or None)
|
|
||||||
"""
|
|
||||||
id: str
|
id: str
|
||||||
url: str
|
url: str
|
||||||
date: Optional[datetime] = None
|
date: Optional[datetime] = None
|
||||||
@@ -45,7 +38,6 @@ class Links:
|
|||||||
self._path = path.path
|
self._path = path.path
|
||||||
else:
|
else:
|
||||||
self._path = path
|
self._path = path
|
||||||
|
|
||||||
self.links: List[Link] = []
|
self.links: List[Link] = []
|
||||||
|
|
||||||
def ret_links(self) -> List[Link]:
|
def ret_links(self) -> List[Link]:
|
||||||
|
|||||||
Reference in New Issue
Block a user