Skip to content

Commit

Permalink
Fix xlsx sorting of promo sets
Browse files Browse the repository at this point in the history
  • Loading branch information
gwax committed Dec 14, 2022
1 parent 9b1b50f commit a67ac2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/*.csv.bak*
/*.xlsx
/*.xlsx.bak*
/.~lock.*

# Profiling data
*.prof
Expand Down
9 changes: 7 additions & 2 deletions mtg_ssm/serialization/xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@
]


def _card_set_sort_key(cset: ScrySet) -> Tuple[dt.date, str]:
def _card_set_sort_key(cset: ScrySet) -> Tuple[dt.date, str, int, str]:
released_at = cset.released_at or dt.date.min
return released_at, cset.code
return (
released_at,
cset.parent_set_code or cset.code,
0 if cset.parent_set_code is None else 1,
cset.code,
)


def create_all_sets(sheet: Worksheet, index: ScryfallDataIndex) -> None:
Expand Down

0 comments on commit a67ac2a

Please sign in to comment.