tt-2026-11-060: lecture du sujet reel du miroir, objet vide vers Sans objet, cascade renommage et suppression de categorie, protection de A classer, tests UI

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGaEeS4wbkMHuVXmz5fqkh
This commit is contained in:
gemini-opsandClaude Sonnet 5.5 committed 2026-11-17 21:43:10 +01:00
1 parent cc371690d8
commit 139b516782
6 files changed
+106 -1

No files matched your search

+8
View File
@@ -127,12 +127,16 @@ def update_category(cat_id: int, new_name: str, db_path: Optional[str] = None) -
conn = get_connection(db_path)
try:
with conn:
ancien = conn.execute("SELECT name FROM categories WHERE id = ?", (cat_id,)).fetchone()
cursor = conn.execute(
"UPDATE categories SET name = ? WHERE id = ?",
(new_name, cat_id)
)
if cursor.rowcount == 0:
return None
if ancien and ancien["name"] != new_name: # CASCADE-060
conn.execute("UPDATE classements SET categorie = ? WHERE categorie = ?", (new_name, ancien["name"]))
conn.execute("UPDATE regles SET categorie = ? WHERE categorie = ?", (new_name, ancien["name"]))
row = conn.execute("SELECT id, name, created_at FROM categories WHERE id = ?", (cat_id,)).fetchone()
return dict(row) if row else None
finally:
@@ -142,7 +146,11 @@ def delete_category(cat_id: int, db_path: Optional[str] = None) -> bool:
conn = get_connection(db_path)
try:
with conn:
ancien = conn.execute("SELECT name FROM categories WHERE id = ?", (cat_id,)).fetchone()
cursor = conn.execute("DELETE FROM categories WHERE id = ?", (cat_id,))
if cursor.rowcount > 0 and ancien: # CASCADE-060
conn.execute("UPDATE classements SET categorie = 'À classer' WHERE categorie = ?", (ancien["name"],))
conn.execute("DELETE FROM regles WHERE categorie = ?", (ancien["name"],))
return cursor.rowcount > 0
finally:
conn.close()