1
0
mirror of synced 2024-11-27 23:40:48 +01:00

mai2: fis issue with saving and loading charges

This commit is contained in:
Kevin Trocolli 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,
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)

View File

@ -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,