Update projektu
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user