Attempt some refactoring

master
trémeur 2 weeks ago
parent d3e97605ac
commit bcab0d3a2a

@ -10,11 +10,11 @@ def searchgen():
wantedcards = []
ownedcollecting = []
for deck in decksofinterest:
if tcgcore.collecting(deck):
wantedlist = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20"]
for card in wantedlist:
combined = deck + card
if combined in tcgcore.ownedcards():
if tcgcore.collecting(deck):
ownedcollecting.append(combined)
else:
wantedcards.append(combined)
@ -46,6 +46,12 @@ def searchgen():
else:
lpt.append(card)
previouscard = card
hpw = sorted(list(dict.fromkeys(hpw)))
mpw = sorted(list(dict.fromkeys(mpw)))
lpw = sorted(list(dict.fromkeys(lpw)))
hpt = sorted(list(dict.fromkeys(hpt)))
mpt = sorted(list(dict.fromkeys(mpt)))
lpt = sorted(list(dict.fromkeys(lpt)))
if not os.path.isdir("build/search"):
os.mkdir("build/search")
thefile = "build/search/index.html"

@ -15,23 +15,21 @@ def wantedgen():
if card[0:4] != "sig_":
decksofinterest.append(card[:-2])
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
wantedcards = []
highpriority = []
medpriority = []
lowpriority = []
for deck in decksofinterest:
if tcgcore.collecting(deck):
wantedlist = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20"]
for card in wantedlist:
combined = deck + card
if combined not in tcgcore.ownedcards():
wantedcards.append(combined)
highpriority = []
medpriority = []
lowpriority = []
for card in wantedcards:
if tcgcore.priority(card[:-2]) == "high":
highpriority.append(card)
elif tcgcore.priority(card[:-2]) == "medium":
medpriority.append(card)
elif tcgcore.priority(card[:-2]) == "low":
lowpriority.append(card)
if tcgcore.priority(deck) == "high":
highpriority.append(combined)
elif tcgcore.priority(deck) == "medium":
medpriority.append(combined)
elif tcgcore.priority(deck) == "low":
lowpriority.append(combined)
if len(highpriority) > 0:
content.write("<h2>High priority</h2>\n<textarea readonly>" + ", ".join(highpriority) + "</textarea>\n<p>")
for card in highpriority:

Loading…
Cancel
Save