Add thresholds for medium and high priority

master
trémeur 1 week 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 - =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” - =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 - =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 - =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 - =tradestatement=: statement to place on your trading page
- =maxmastered=: maximum number of most recently mastered decks to show on the index page - =maxmastered=: maximum number of most recently mastered decks to show on the index page

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

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

@ -76,6 +76,22 @@ def collecting(deck):
else: else:
return False 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): def cardtype(card):
with open("build/decks/" + card[:-2] + "/type") as thetype: with open("build/decks/" + card[:-2] + "/type") as thetype:
cardtype = thetype.read() cardtype = thetype.read()

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

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

Loading…
Cancel
Save