wacca: fix time free not saving, add counter to profile table

This commit is contained in:
Hay1tsme 2023-04-20 09:46:18 -04:00
parent 00b127361b
commit a30967e8d7
5 changed files with 13 additions and 5 deletions

View File

@ -0,0 +1 @@
ALTER TABLE wacca_profile DROP COLUMN playcount_time_free;

View File

@ -0,0 +1 @@
ALTER TABLE wacca_profile ADD playcount_time_free int(11) DEFAULT 0 NULL AFTER playcount_stageup;

View File

@ -9,4 +9,4 @@ database = WaccaData
reader = WaccaReader
frontend = WaccaFrontend
game_codes = [WaccaConstants.GAME_CODE]
current_schema_version = 4
current_schema_version = 5

View File

@ -941,6 +941,7 @@ class PlayType(Enum):
PlayTypeVs = 2
PlayTypeCoop = 3
PlayTypeStageup = 4
PlayTypeTimeFree = 5
class StageInfo:

View File

@ -7,6 +7,7 @@ from sqlalchemy.engine import Row
from sqlalchemy.dialects.mysql import insert
from core.data.schema import BaseData, metadata
from ..handlers.helpers import PlayType
profile = Table(
"wacca_profile",
@ -40,6 +41,7 @@ profile = Table(
Column("playcount_multi_vs", Integer, server_default="0"),
Column("playcount_multi_coop", Integer, server_default="0"),
Column("playcount_stageup", Integer, server_default="0"),
Column("playcount_time_free", Integer, server_default="0"),
Column("friend_view_1", Integer),
Column("friend_view_2", Integer),
Column("friend_view_3", Integer),
@ -160,17 +162,20 @@ class WaccaProfileData(BaseData):
) -> None:
sql = profile.update(profile.c.id == profile_id).values(
playcount_single=profile.c.playcount_single + 1
if play_type == 1
if play_type == PlayType.PlayTypeSingle.value
else profile.c.playcount_single,
playcount_multi_vs=profile.c.playcount_multi_vs + 1
if play_type == 2
if play_type == PlayType.PlayTypeVs.value
else profile.c.playcount_multi_vs,
playcount_multi_coop=profile.c.playcount_multi_coop + 1
if play_type == 3
if play_type == PlayType.PlayTypeCoop.value
else profile.c.playcount_multi_coop,
playcount_stageup=profile.c.playcount_stageup + 1
if play_type == 4
if play_type == PlayType.PlayTypeStageup.value
else profile.c.playcount_stageup,
playcount_time_free=profile.c.playcount_time_free + 1
if play_type == PlayType.PlayTypeTimeFree.value
else profile.c.playcount_time_free,
last_game_ver=game_version,
)