From ad61bb3d9b9de3a97984efd9f3b8165f8e31d757 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Fri, 24 Nov 2023 10:36:46 -0500 Subject: [PATCH] mai2: fis issue with saving and loading charges --- titles/mai2/base.py | 18 ++++-------------- titles/mai2/schema/item.py | 4 ++-- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/titles/mai2/base.py b/titles/mai2/base.py index 8d5a914..b896b4f 100644 --- a/titles/mai2/base.py +++ b/titles/mai2/base.py @@ -228,8 +228,8 @@ class Mai2Base: user_id, charge["chargeId"], charge["stock"], - datetime.strptime(charge["purchaseDate"], Mai2Constants.DATE_TIME_FORMAT), - datetime.strptime(charge["validDate"], Mai2Constants.DATE_TIME_FORMAT), + charge["purchaseDate"], # Ideally these should be datetimes, but db was + charge["validDate"] # set up with them being str, so str it is for now ) return {"returnCode": 1, "apiName": "UpsertUserChargelogApi"} @@ -303,12 +303,8 @@ class Mai2Base: user_id, charge["chargeId"], charge["stock"], - datetime.strptime( - charge["purchaseDate"], Mai2Constants.DATE_TIME_FORMAT - ), - datetime.strptime( - charge["validDate"], Mai2Constants.DATE_TIME_FORMAT - ), + charge["purchaseDate"], + charge["validDate"] ) if "userCharacterList" in upsert and len(upsert["userCharacterList"]) > 0: @@ -458,12 +454,6 @@ class Mai2Base: tmp = charge._asdict() tmp.pop("id") tmp.pop("user") - tmp["purchaseDate"] = datetime.strftime( - tmp["purchaseDate"], Mai2Constants.DATE_TIME_FORMAT - ) - tmp["validDate"] = datetime.strftime( - tmp["validDate"], Mai2Constants.DATE_TIME_FORMAT - ) user_charge_list.append(tmp) diff --git a/titles/mai2/schema/item.py b/titles/mai2/schema/item.py index 5bc011c..a6ed876 100644 --- a/titles/mai2/schema/item.py +++ b/titles/mai2/schema/item.py @@ -501,8 +501,8 @@ class Mai2ItemData(BaseData): user_id: int, charge_id: int, stock: int, - purchase_date: datetime, - valid_date: datetime, + purchase_date: str, + valid_date: str, ) -> Optional[Row]: sql = insert(charge).values( user=user_id,