1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 15:02:59 +00:00

elemental decks sorting

This commit is contained in:
Jörn-Michael Miehe 2021-09-02 02:54:42 +02:00
parent c2f0f7f050
commit 9d5412a12c
2 changed files with 7 additions and 6 deletions

View file

@ -14,10 +14,6 @@ class Book:
def __init__(self, cards: Cards, language: Language, num_threads: int): def __init__(self, cards: Cards, language: Language, num_threads: int):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# sort cards by element, then alphabetically
# cards.sort(key=lambda x: x[""].name)
# cards.sort(key=lambda x: "Multi" if len(x.elements) > 1 else x.elements[0])
# all card face URLs # all card face URLs
urls = [ urls = [
("https://fftcg.cdn.sewest.net/images/cards/full/{}_{}.jpg", card.code.long, language.image_suffix) ("https://fftcg.cdn.sewest.net/images/cards/full/{}_{}.jpg", card.code.long, language.image_suffix)

View file

@ -89,7 +89,7 @@ class Opus(Cards):
for card in self for card in self
], ],
f"{self.name}", f"{self.name}",
f"All {self.name} Cards in elemental, then alphabetical order" f"All {self.name} Cards"
)] )]
else: else:
@ -110,10 +110,15 @@ class Opus(Cards):
"Multi": lambda card: len(card.elements) > 1, "Multi": lambda card: len(card.elements) > 1,
} }
# sort cards by element, then alphabetically
cards = list(self)
cards.sort(key=lambda x: x[self.__language].name)
cards.sort(key=lambda x: "Multi" if len(x.elements) > 1 else x.elements[0])
return [TTSDeck( return [TTSDeck(
[ [
card.code card.code
for card in self for card in cards
if f(card) if f(card)
], ],
f"{self.name} {elem}", f"{self.name} {elem}",