Update projektu

This commit is contained in:
lachtan
2026-07-22 12:32:02 +02:00
parent 19014ed3d9
commit 8e66d6b92a
22 changed files with 1995 additions and 503 deletions

View File

@@ -204,6 +204,27 @@ def find_active_by_keyword(conn: sqlite3.Connection, keyword: str) -> list[dict]
return [dict(r) for r in rows]
def find_active_by_exact_text(
conn: sqlite3.Connection, text: str, exclude_id: int | None = None
) -> list[dict]:
"""Active reminders whose text equals `text` (trimmed, case-insensitive).
Comparison happens in Python via ``casefold`` — SQLite's ``lower()`` only
folds ASCII, so Czech diacritics ("Čaj"/"čaj") would slip through. Pass
``exclude_id`` to ignore the reminder currently being edited.
"""
target = text.strip().casefold()
rows = conn.execute(
"SELECT id, text, enabled, timezone, created_at, updated_at, deleted_at "
"FROM reminders WHERE deleted_at IS NULL"
).fetchall()
return [
dict(r)
for r in rows
if r["id"] != exclude_id and r["text"].strip().casefold() == target
]
def active_display_order(conn: sqlite3.Connection) -> list[int]:
"""Internal ids of active reminders in display order (ascending by id)."""
rows = conn.execute(