🐛 Fix hoyolab missing diary date

This commit is contained in:
xtaodada 2024-05-24 23:34:00 +08:00
parent 84682e7fae
commit 124c7533d7
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -150,7 +150,7 @@ class LedgerPlugin(Plugin):
async def save_ledger_data( async def save_ledger_data(
history_data_ledger: "HistoryDataLedgerServices", uid: int, ledger_data: "Diary" history_data_ledger: "HistoryDataLedgerServices", uid: int, ledger_data: "Diary"
) -> bool: ) -> bool:
month = int(ledger_data.date.split("-")[1]) month = int((ledger_data.date or datetime.now().strftime("%Y-%m-%d")).split("-")[1])
if month == ledger_data.month: if month == ledger_data.month:
return False return False
model = history_data_ledger.create(uid, ledger_data) model = history_data_ledger.create(uid, ledger_data)