Account for incoming random cards in incomplete trades

This commit is contained in:
mez 2025-09-02 23:11:31 +01:00
parent c7cf249304
commit 6c61a2bcfc
3 changed files with 35 additions and 14 deletions

View file

@ -2342,22 +2342,42 @@ def pendtradesgen():
if variables.newtab:
content.write(" target=\"_blank\"")
content.write("><code>" + event["date"].strftime("%Y-%m-%d") + "</code></a></p>\n")
if event["lost"]:
try:
allin = len(event["pend"]) + event["randomsin"]
except:
try:
allin = len(event["pend"])
except:
allin = 0
try:
if len(event["lost"]) > allin:
lostlist = event["lost"][-(allin):]
else:
lostlist = event["lost"]
except:
try:
lostlist = event["lost"]
except:
lostlist = []
lostlist = sorted(lostlist)
if len(lostlist) > 0:
content.write("<p>Offered: ")
lostlist = sorted(event["lost"])
for card in lostlist:
content.write(printcard(card))
content.write("</p>\n")
if event["pend"]:
content.write("<p>Requested: ")
pendlist = sorted(event["pend"])
position = 1
for card in pendlist:
content.write(cardtext(card))
if len(pendlist) != position:
content.write(", ")
position += 1
content.write(".</p>\n")
try:
if event["pend"]:
content.write("<p>Requested: ")
pendlist = sorted(event["pend"])
position = 1
for card in pendlist:
content.write(cardtext(card))
if len(pendlist) != position:
content.write(", ")
position += 1
content.write(".</p>\n")
except:
pass
content.close()
footerwrite(thefile)