This commit is contained in:
283375 2023-06-21 20:56:23 +08:00
parent 920e2bda98
commit da693954e3
2 changed files with 24 additions and 18 deletions

View File

@ -75,6 +75,7 @@ INIT_SQLS: Dict[int, VersionSqls] = {
""" """
CREATE VIEW IF NOT EXISTS calculated AS CREATE VIEW IF NOT EXISTS calculated AS
SELECT SELECT
scores.id,
scores.song_id, scores.song_id,
scores.rating_class, scores.rating_class,
scores.score, scores.score,
@ -96,8 +97,7 @@ INIT_SQLS: Dict[int, VersionSqls] = {
LEFT JOIN charts ON scores.rating_class = charts.rating_class LEFT JOIN charts ON scores.rating_class = charts.rating_class
AND scores.song_id = charts.song_id AND scores.song_id = charts.song_id
GROUP BY GROUP BY
scores.song_id, scores.id
scores.rating_class
""", """,
""" """
CREATE VIEW IF NOT EXISTS bests AS CREATE VIEW IF NOT EXISTS bests AS

View File

@ -92,26 +92,30 @@ class Package:
@dataclass @dataclass
class DbScoreRow: class DbScoreRow:
id: int
song_id: str song_id: str
rating_class: int rating_class: int
score: int score: int
pure: int pure: Optional[int]
far: int far: Optional[int]
lost: int lost: Optional[int]
time: int time: int
max_recall: Optional[int] = None max_recall: Optional[int]
clear_type: Optional[int]
@dataclass(kw_only=True) @dataclass(kw_only=True)
class Score: class Score:
id: int
song_id: str song_id: str
rating_class: int rating_class: int
score: int score: int
pure: int pure: Optional[int]
far: int far: Optional[int]
lost: int lost: Optional[int]
time: int time: int
max_recall: Optional[int] = None max_recall: Optional[int]
clear_type: Optional[int]
@classmethod @classmethod
def from_db_row(cls, row: DbScoreRow): def from_db_row(cls, row: DbScoreRow):
@ -125,31 +129,33 @@ class Score:
@dataclass @dataclass
class DbCalculatedRow: class DbCalculatedRow:
id: int
song_id: str song_id: str
rating_class: int rating_class: int
score: int score: int
pure: int pure: Optional[int]
far: int far: Optional[int]
lost: int lost: Optional[int]
time: int time: int
rating: int rating: int
note: int note: int
pure_small: int pure_small: Optional[int]
potential: float potential: float
@dataclass(kw_only=True) @dataclass(kw_only=True)
class Calculated: class Calculated:
id: int
song_id: str song_id: str
rating_class: int rating_class: int
score: int score: int
pure: int pure: Optional[int]
far: int far: Optional[int]
lost: int lost: Optional[int]
time: int time: int
rating: int rating: int
note: int note: int
pure_small: int pure_small: Optional[int]
potential: float potential: float
@classmethod @classmethod