From 6226b2b6d6300a0f51843dce3bf49cf6573d9f65 Mon Sep 17 00:00:00 2001 From: "Markus M." Date: Sun, 4 Jan 2026 16:19:32 +0100 Subject: [PATCH] fixed return values for printhistory --- print_history.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/print_history.py b/print_history.py index f94a36f0..28521ddf 100644 --- a/print_history.py +++ b/print_history.py @@ -244,13 +244,14 @@ def get_prints_by_spool(spool_id: int): Retrieves all print jobs that used a specific spool. """ conn = sqlite3.connect(db_config["db_path"]) + conn.row_factory = sqlite3.Row cursor = conn.cursor() cursor.execute(''' SELECT DISTINCT p.* FROM prints p JOIN filament_usage f ON p.id = f.print_id WHERE f.spool_id = ? ''', (spool_id,)) - prints = cursor.fetchall() + prints = [dict(row) for row in cursor.fetchall()] conn.close() return prints @@ -264,9 +265,9 @@ def get_filament_for_slot(print_id: int, ams_slot: int): WHERE print_id = ? AND ams_slot = ? ''', (print_id, ams_slot)) - results = cursor.fetchone() + row = cursor.fetchone() conn.close() - return results + return dict(row) if row else None def _ensure_layer_tracking_entry(print_id: int): conn = sqlite3.connect(db_config["db_path"])