Skip to content

Commit 59197cb

Browse files
hansmortii
authored andcommitted
bugfix: avoid deeply nested SQL query which can crash
1 parent 12305ff commit 59197cb

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

ankimorphs/ankimorphs_db.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,9 @@ def rebuild_seen_morphs_today_background() -> None:
622622

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

630629
am_db.drop_seen_morphs_table()
631630
am_db.create_seen_morph_table()

ankimorphs/ankimorphs_globals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
# Semantic Versioning https://semver.org/
8-
__version__ = "3.2.0"
8+
__version__ = "3.2.1"
99

1010
DEV_MODE: bool = False
1111

docs/src/contributors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ know, and I'll add you ;)
66

77
### Code contribution
88

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

1111
### Docs contribution
1212

0 commit comments

Comments
 (0)