") faveslist = sorted(variables.faves) for card in faveslist: - for thecard in cardlist: - if card == thecard["name"]: - content.write(printcard(thecard)) - break + content.write(printcard(card)) content.write("
\n") if len(coupons) > 0: content.write("") @@ -1114,26 +1119,43 @@ def indexgen(): content.write("
\n") donations = [] try: - for deck in variables.donations["decks"]: - donations.append(deck + "00") + for donatedeck in variables.donations["decks"]: + donation = {} + donation["name"] = donatedeck + for deck in decklist: + if deck["name"] == donatedeck: + if deck["mastered"]: + donation["type"] = "mastered" + else: + donation["type"] = "deck" + break + donations.append(donation) except: pass try: for card in variables.donations["scrapbook"]: - donations.append(card) + donation = {} + donation["name"] = card + donation["type"] = "single" + donations.append(donation) except: pass if len(donations) > 0: - donations = sorted(donations) + donations = sorted(donations, key=lambda d: d["name"]) content.write("")
for donation in donations:
- if donation[-2:] == "00":
- content.write("")
- else:
- for thecard in cardlist:
- if donation == thecard["name"]:
- content.write(printcard(thecard))
- break
+ if donation["type"] == "deck":
+ content.write("
")
+ elif donation["type"] == "mastered":
+ content.write("
")
+ elif donation["type"] == "single":
+ content.write(printcard(donation["name"]))
content.write("