mai2: fis issue with saving and loading charges
This commit is contained in:
parent
8bd361d3e3
commit
ad61bb3d9b
@ -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)
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user