diff --git a/README.org b/README.org index cb952cb..f71bde1 100644 --- a/README.org +++ b/README.org @@ -69,5 +69,5 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards - Add level images manually to =build/assets/levels/= - Add custom CSS to =build/user.css= *** Updating and building -- For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"=, ="decks"=, ="coupons"=, ="pend"=, ="unpend"= that aren’t relevant). +- For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"=, ="decks"=, ="coupons"=, ="pend"=, ="unpend"=, ="randomsin"= that aren’t relevant). - Run =./build.sh= in this directory to download the relevant card images and then upload everything to the server. diff --git a/colors.py b/colors.py index d37d004..ff840e9 100644 --- a/colors.py +++ b/colors.py @@ -2342,22 +2342,42 @@ def pendtradesgen(): if variables.newtab: content.write(" target=\"_blank\"") content.write(">" + event["date"].strftime("%Y-%m-%d") + "

\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("

Offered: ") - lostlist = sorted(event["lost"]) for card in lostlist: content.write(printcard(card)) content.write("

\n") - if event["pend"]: - content.write("

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(".

\n") + try: + if event["pend"]: + content.write("

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(".

\n") + except: + pass content.close() footerwrite(thefile) diff --git a/log-template.py b/log-template.py index 5dd55b7..e6af18b 100644 --- a/log-template.py +++ b/log-template.py @@ -11,6 +11,7 @@ log = [ "decks":["deck1","deck2","deck3","deck4","deck5","deck6","deck7","deck8"], # only if "event":"portfolio" "sketch":-1, # for turning in 1 sketchpad "pend":["card05"], # to mark a card as pending - "unpend":["card06"] # to remove a card from the pending list if a trade is cancelled + "unpend":["card06"], # to remove a card from the pending list if a trade is cancelled + "randomsin":0 # for incomplete trades where you anticipate receiving a specified number of random cards } ]