From a30967e8d79ea0defeb06dcacfb62571d525ff3f Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 20 Apr 2023 09:46:18 -0400 Subject: [PATCH] wacca: fix time free not saving, add counter to profile table --- core/data/schema/versions/SDFE_4_rollback.sql | 1 + core/data/schema/versions/SDFE_5_upgrade.sql | 1 + titles/wacca/__init__.py | 2 +- titles/wacca/handlers/helpers.py | 1 + titles/wacca/schema/profile.py | 13 +++++++++---- 5 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 core/data/schema/versions/SDFE_4_rollback.sql create mode 100644 core/data/schema/versions/SDFE_5_upgrade.sql diff --git a/core/data/schema/versions/SDFE_4_rollback.sql b/core/data/schema/versions/SDFE_4_rollback.sql new file mode 100644 index 0000000..417c227 --- /dev/null +++ b/core/data/schema/versions/SDFE_4_rollback.sql @@ -0,0 +1 @@ +ALTER TABLE wacca_profile DROP COLUMN playcount_time_free; \ No newline at end of file diff --git a/core/data/schema/versions/SDFE_5_upgrade.sql b/core/data/schema/versions/SDFE_5_upgrade.sql new file mode 100644 index 0000000..a9795bf --- /dev/null +++ b/core/data/schema/versions/SDFE_5_upgrade.sql @@ -0,0 +1 @@ +ALTER TABLE wacca_profile ADD playcount_time_free int(11) DEFAULT 0 NULL AFTER playcount_stageup; \ No newline at end of file diff --git a/titles/wacca/__init__.py b/titles/wacca/__init__.py index b3f9850..a3bf96b 100644 --- a/titles/wacca/__init__.py +++ b/titles/wacca/__init__.py @@ -9,4 +9,4 @@ database = WaccaData reader = WaccaReader frontend = WaccaFrontend game_codes = [WaccaConstants.GAME_CODE] -current_schema_version = 4 +current_schema_version = 5 diff --git a/titles/wacca/handlers/helpers.py b/titles/wacca/handlers/helpers.py index dc836ce..b17602a 100644 --- a/titles/wacca/handlers/helpers.py +++ b/titles/wacca/handlers/helpers.py @@ -941,6 +941,7 @@ class PlayType(Enum): PlayTypeVs = 2 PlayTypeCoop = 3 PlayTypeStageup = 4 + PlayTypeTimeFree = 5 class StageInfo: diff --git a/titles/wacca/schema/profile.py b/titles/wacca/schema/profile.py index 27111be..48eb800 100644 --- a/titles/wacca/schema/profile.py +++ b/titles/wacca/schema/profile.py @@ -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, )