Skip to content

Commit

Permalink
bugfix: avoid deeply nested SQL query which can crash
Browse files Browse the repository at this point in the history
  • Loading branch information
hans authored and mortii committed Oct 4, 2024
1 parent 12305ff commit 59197cb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions ankimorphs/ankimorphs_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,9 @@ def rebuild_seen_morphs_today_background() -> None:

where_query_string = ""
if len(cards_studied_today) > 0:
where_query_string = "WHERE" + "".join(
[f" card_id = {card_id} OR" for card_id in cards_studied_today]
where_query_string = (
"WHERE card_id IN (" + ",".join(map(str, cards_studied_today)) + ")"
)
where_query_string = where_query_string[:-3] # removes the last " OR"

am_db.drop_seen_morphs_table()
am_db.create_seen_morph_table()
Expand Down
2 changes: 1 addition & 1 deletion ankimorphs/ankimorphs_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

# Semantic Versioning https://semver.org/
__version__ = "3.2.0"
__version__ = "3.2.1"

DEV_MODE: bool = False

Expand Down
2 changes: 1 addition & 1 deletion docs/src/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ know, and I'll add you ;)

### Code contribution

mortii, Vilhelm-Ian, xofm31, Jcuhfehl, schiozzone, Tartee, wolearyc, mdraves91.
mortii, Vilhelm-Ian, xofm31, Jcuhfehl, schiozzone, Tartee, wolearyc, mdraves91, hans.

### Docs contribution

Expand Down

0 comments on commit 59197cb

Please sign in to comment.