Build decklist more quickly
This commit is contained in:
parent
b7f628944d
commit
bc66981557
1 changed files with 27 additions and 23 deletions
50
colors.py
50
colors.py
|
@ -426,37 +426,41 @@ for deck in decks:
|
|||
thedeck["massmaster"].append(theme)
|
||||
except KeyError:
|
||||
pass
|
||||
count = 0
|
||||
for number in numbers:
|
||||
thedeck[number] = None
|
||||
for card in cardlist:
|
||||
if card["name"] == deck + number:
|
||||
if thedeck[number] == None:
|
||||
thedeck[number] = card["received"]
|
||||
count += 1
|
||||
thedeck["count"] = count
|
||||
if count == 20:
|
||||
thedeck["count"] = 0
|
||||
decklist.append(thedeck)
|
||||
|
||||
for card in cardlist:
|
||||
if card["colour"] != "sig":
|
||||
for deck in decklist:
|
||||
if deck["name"] == card["name"][:-2]:
|
||||
if deck[card["name"][-2:]] == None:
|
||||
deck[card["name"][-2:]] = card["received"]
|
||||
deck["count"] += 1
|
||||
|
||||
for deck in decklist:
|
||||
if deck["count"] == 20:
|
||||
dates = []
|
||||
for number in numbers:
|
||||
dates.append(thedeck[number])
|
||||
dates.append(deck[number])
|
||||
dates = sorted(dates)
|
||||
thedeck["mastered"] = dates[-1]
|
||||
deck["mastered"] = dates[-1]
|
||||
else:
|
||||
thedeck["mastered"] = False
|
||||
if deck in variables.highpriority or count >= variables.highthreshold or deck in portdecks or thedeck["colour"] == "limited":
|
||||
thedeck["priority"] = 1
|
||||
elif len(thedeck["mass"]) > 0:
|
||||
if count >= variables.massmediumthreshold:
|
||||
thedeck["priority"] = 2
|
||||
deck["mastered"] = False
|
||||
if deck["name"] in variables.highpriority or deck["count"] >= variables.highthreshold or deck["name"] in portdecks or deck["colour"] == "limited":
|
||||
deck["priority"] = 1
|
||||
elif len(deck["mass"]) > 0:
|
||||
if deck["count"] >= variables.massmediumthreshold:
|
||||
deck["priority"] = 2
|
||||
else:
|
||||
thedeck["priority"] = 3
|
||||
elif count >= variables.mediumthreshold:
|
||||
thedeck["priority"] = 2
|
||||
elif count >= variables.collectthreshold:
|
||||
thedeck["priority"] = 3
|
||||
deck["priority"] = 3
|
||||
elif deck["count"] >= variables.mediumthreshold:
|
||||
deck["priority"] = 2
|
||||
elif deck["count"] >= variables.collectthreshold:
|
||||
deck["priority"] = 3
|
||||
else:
|
||||
thedeck["priority"] = 4
|
||||
decklist.append(thedeck)
|
||||
deck["priority"] = 4
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Checking for new card images")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue