diff --git a/README.org b/README.org index 46726fd..d1de77e 100644 --- a/README.org +++ b/README.org @@ -44,7 +44,4 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards - For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"=, ="decks"= that aren’t relevant). - Run =./build.sh= in this directory to download the relevant card images and then upload everything to the server. ** Currently unaccounted for -- Duplicates (should be fine but not checked) - Coupons -- Card search -- Date to level – needs redone diff --git a/tcgcore.py b/tcgcore.py index 9f129a8..274bbf9 100644 --- a/tcgcore.py +++ b/tcgcore.py @@ -72,13 +72,21 @@ def collecting(deck): if deck in variables.highpriority: return True else: - if deck in medium: - return True - else: - if len(deckcards(deck)) < variables.collectthreshold: - return False - else: + portfoliocollecting = False + for event in log.log: + if portfoliocollecting == False: + if event["event"] == "portfolio": + if deck in event["decks"]: + portfoliocollecting = True + return True + if portfoliocollecting == False: + if deck in medium: return True + else: + if len(deckcards(deck)) < variables.collectthreshold: + return False + else: + return True else: return False @@ -86,17 +94,23 @@ def priority(deck): if collecting(deck): if deck in variables.highpriority: return "high" + elif len(deckcards(deck)) >= variables.highthreshold: + return "high" else: - if len(deckcards(deck)) >= variables.highthreshold: - return "high" - else: + portfoliopriority = False + for event in log.log: + if portfoliopriority == False: + if event["event"] == "portfolio": + if deck in event["decks"]: + portfoliopriority = True + return "high" + if portfoliopriority == False: if deck in medium: return "medium" + elif len(deckcards(deck)) >= variables.mediumthreshold: + return "medium" else: - if len(deckcards(deck)) >= variables.mediumthreshold: - return "medium" - else: - return ("low") + return ("low") def cardtype(card): with open("build/decks/" + card[:-2] + "/type") as thetype: