mai2: fis issue with saving and loading charges

This commit is contained in:
Hay1tsme 2023-11-24 10:36:46 -05:00
parent 8bd361d3e3
commit ad61bb3d9b
2 changed files with 6 additions and 16 deletions

View File

@ -228,8 +228,8 @@ class Mai2Base:
user_id, user_id,
charge["chargeId"], charge["chargeId"],
charge["stock"], charge["stock"],
datetime.strptime(charge["purchaseDate"], Mai2Constants.DATE_TIME_FORMAT), charge["purchaseDate"], # Ideally these should be datetimes, but db was
datetime.strptime(charge["validDate"], Mai2Constants.DATE_TIME_FORMAT), charge["validDate"] # set up with them being str, so str it is for now
) )
return {"returnCode": 1, "apiName": "UpsertUserChargelogApi"} return {"returnCode": 1, "apiName": "UpsertUserChargelogApi"}
@ -303,12 +303,8 @@ class Mai2Base:
user_id, user_id,
charge["chargeId"], charge["chargeId"],
charge["stock"], charge["stock"],
datetime.strptime( charge["purchaseDate"],
charge["purchaseDate"], Mai2Constants.DATE_TIME_FORMAT charge["validDate"]
),
datetime.strptime(
charge["validDate"], Mai2Constants.DATE_TIME_FORMAT
),
) )
if "userCharacterList" in upsert and len(upsert["userCharacterList"]) > 0: if "userCharacterList" in upsert and len(upsert["userCharacterList"]) > 0:
@ -458,12 +454,6 @@ class Mai2Base:
tmp = charge._asdict() tmp = charge._asdict()
tmp.pop("id") tmp.pop("id")
tmp.pop("user") 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) user_charge_list.append(tmp)

View File

@ -501,8 +501,8 @@ class Mai2ItemData(BaseData):
user_id: int, user_id: int,
charge_id: int, charge_id: int,
stock: int, stock: int,
purchase_date: datetime, purchase_date: str,
valid_date: datetime, valid_date: str,
) -> Optional[Row]: ) -> Optional[Row]:
sql = insert(charge).values( sql = insert(charge).values(
user=user_id, user=user_id,