allnet: fix playhistory

This commit is contained in:
2025-04-24 23:56:19 -04:00
parent eea9ca21ca
commit a74ca85300
2 changed files with 25 additions and 12 deletions

View File

@ -611,12 +611,13 @@ class BillingServlet:
"playlimit": req.playlimit,
"messages": []
}
playhist = "000000/0:000000/0:000000/0"
if machine is not None:
if self.config.allnet.save_billing:
lastcredit = await self.data.arcade.billing_get_credit(machine['id'], req.gameid)
lastcredit = await self.data.arcade.billing_get_last_playcount(machine['id'], req.gameid)
if lastcredit is not None:
last_playct = lastcredit['playcount']
last_playct = lastcredit['playct']
else:
last_playct = 0
@ -630,14 +631,8 @@ class BillingServlet:
if plays is not None and len(plays) > 0:
playhist = ""
for x in range(len(plays), 0, -1): playhist += f"{plays[x]['year']:04d}{plays[x]['month']:02d}/{plays[x]['playct']}:"
for x in range(len(plays) - 1, -1, -1): playhist += f"{plays[x]['year']:04d}{plays[x]['month']:02d}/{plays[x]['playct']}:"
playhist = playhist[:-1]
else:
playhist = "000000/0:000000/0:000000/0"
else:
playhist = "000000/0:000000/0:000000/0"
for x in range(1, len(req_dict)):
if not req_dict[x]:
@ -693,7 +688,7 @@ class BillingServlet:
)
self.logger.info(
f"Credit Trace from {req.keychipid}: {tmp.operation_type} mode, {tmp.credit_rate} coins per credit, Consumed {tmp.credit0} | {tmp.credit1} | {tmp.credit2} | {tmp.credit3} | {tmp.credit4} | {tmp.credit5} | {tmp.credit6} | {tmp.credit7} | "
f"Credit Trace from {req.keychipid}: {tmp.operation_type} mode, {tmp.credit_rate} coins per credit, breakdown: {tmp.credit0} | {tmp.credit1} | {tmp.credit2} | {tmp.credit3} | {tmp.credit4} | {tmp.credit5} | {tmp.credit6} | {tmp.credit7} | "
)
except KeyError as e: