Remove magic strings and use constants instead.

This commit is contained in:
Jennifer Taylor 2020-12-17 20:16:30 +00:00
parent 416904100b
commit b7bd09bb62
2 changed files with 7 additions and 3 deletions

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Iterator, Tuple
from flask_caching import Cache # type: ignore
from bemani.backend.museca import MusecaFactory, MusecaBase
from bemani.common import GameConstants, ValidatedDict
from bemani.common import GameConstants, VersionConstants, DBConstants, ValidatedDict
from bemani.data import Attempt, Data, Score, Song, UserID
from bemani.frontend.base import FrontendBase
@ -24,7 +24,11 @@ class MusecaFrontend(FrontendBase):
def all_games(self) -> Iterator[Tuple[str, int, str]]:
yield from MusecaFactory.all_games()
yield ('museca', 10002, 'MÚSECA PLUS') # Hard code entry for MÚSECA PLUS since entries will go in blank category otherwise
yield (
GameConstants.MUSECA,
VersionConstants.MUSECA_1_PLUS + DBConstants.OMNIMIX_VERSION_BUMP,
'MÚSECA PLUS',
) # Hard code entry for MÚSECA PLUS since entries will go in blank category otherwise
def format_score(self, userid: UserID, score: Score) -> Dict[str, Any]:
formatted_score = super().format_score(userid, score)

View File

@ -33,7 +33,7 @@ class PopnMusicFrontend(FrontendBase):
def all_games(self) -> Iterator[Tuple[str, int, str]]:
yield from PopnMusicFactory.all_games()
yield ('pnm', 0, 'CS and Licenses') # Folder that doesn't belong to any specific game
yield (GameConstants.POPN_MUSIC, 0, 'CS and Licenses') # Folder that doesn't belong to any specific game
def format_score(self, userid: UserID, score: Score) -> Dict[str, Any]:
formatted_score = super().format_score(userid, score)