Add thresholds for medium and high priority

master
trémeur 1 month ago
parent b69b705373
commit c1d73d661f

@ -26,6 +26,8 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
- =headerbackground=: an HTML colour to display behind your header image and set as a theme colour
- =british=: =True= if you want “grey” to display on the site, =False= if you want “gray”
- =collectthreshold=: minimum number of owned cards for putting a deck in the “collecting” category
- =mediumthreshold=: minimum number of owned cards for marking a deck as medium priority
- =highthreshold=: minimum number of owned cards for marking a deck as high priority
- =keepsig=: =True= if you always want to keep one copy of your signature, =False= if you want to make them all available for trading
- =tradestatement=: statement to place on your trading page
- =maxmastered=: maximum number of most recently mastered decks to show on the index page

@ -29,9 +29,9 @@ def collectinggen(colour=False):
lowpriority = []
for deck in decksofinterest:
if tcgcore.collecting(deck):
if deck in variables.highpriority:
if tcgcore.priority(deck) == "high":
highpriority.append(deck)
elif deck in variables.medpriority:
elif tcgcore.priority(deck) == "medium":
medpriority.append(deck)
else:
lowpriority.append(deck)

@ -25,13 +25,12 @@ def searchgen():
mpt = []
lpt = []
for card in wantedcards:
if card[:-2] in variables.highpriority:
if tcgcore.priority(card[:-2]) == "high":
hpw.append(card)
elif card[:-2] in variables.medpriority:
elif tcgcore.priority(card[:-2]) == "medium":
mpw.append(card)
else:
if tcgcore.collecting(card[:-2]):
lpw.append(card)
elif tcgcore.priority(card[:-2]) == "low":
lpw.append(card)
previouscard = ""
for card in tcgcore.ownedcards():
if card[0:4] != "sig_":
@ -40,10 +39,9 @@ def searchgen():
else:
if not tcgcore.deckmastered(card[:-2]):
if card in ownedcollecting:
if card[:-2] in variables.medpriority:
if tcgcore.priority(card[:-2]) == "medium":
hpt.append(card)
else:
if card[:-2] not in variables.highpriority:
elif tcgcore.priority(card[:-2]) == "low":
mpt.append(card)
else:
lpt.append(card)

@ -76,6 +76,22 @@ def collecting(deck):
else:
return False
def priority(deck):
if collecting(deck):
if deck in variables.highpriority:
return "high"
else:
if len(deckcards(deck)) >= variables.highthreshold:
return "high"
else:
if deck in variables.medpriority:
return "medium"
else:
if len(deckcards(deck)) >= variables.mediumthreshold:
return "medium"
else:
return ("low")
def cardtype(card):
with open("build/decks/" + card[:-2] + "/type") as thetype:
cardtype = thetype.read()

@ -8,6 +8,8 @@ faves = ["favecard01","favecard02"]
headerbackground = "#000000"
british = True
collectthreshold = 2
mediumthreshold = 5
highthreshold = 10
keepsig = False
tradestatement = ""
maxmastered = 20

@ -26,13 +26,12 @@ def wantedgen():
medpriority = []
lowpriority = []
for card in wantedcards:
if card[:-2] in variables.highpriority:
if tcgcore.priority(card[:-2]) == "high":
highpriority.append(card)
elif card[:-2] in variables.medpriority:
elif tcgcore.priority(card[:-2]) == "medium":
medpriority.append(card)
else:
if tcgcore.collecting(card[:-2]):
lowpriority.append(card)
elif tcgcore.priority(card[:-2]) == "low":
lowpriority.append(card)
if len(highpriority) > 0:
content.write("<p><b>High priority:</b> ")
for card in highpriority:

Loading…
Cancel
Save