Skip to content

Commit

Permalink
Reverse story titles to put them in the correct order
Browse files Browse the repository at this point in the history
  • Loading branch information
mizaki committed Aug 10, 2024
1 parent e00739b commit 3fde50d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gcd_talker/gcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,19 @@ def _format_gcd_issue(self, row: sqlite3.Row, complete: bool = False) -> GCDIssu
# Convert for attribute access
row_dict = dict(row)

# Reverse story titles as they cannot be ordered in SQL query
story_titles: list[str] = []
if row_dict["story_titles"] is not None:
story_titles = row_dict["story_titles"].split("\n")
story_titles.reverse()

gcd_issue = GCDIssue(
id=row_dict["id"],
key_date=row_dict["key_date"],
number=row_dict["number"],
issue_title=row_dict["issue_title"],
series_id=row_dict["series_id"],
story_titles=(
row_dict["story_titles"].split("\n")
if "story_titles" in row_dict and row_dict["story_titles"] is not None
else []
),
story_titles=story_titles,
synopses=(
row_dict["synopses"].split("\n\n")
if "synopses" in row_dict and row_dict["synopses"] is not None
Expand Down

0 comments on commit 3fde50d

Please sign in to comment.