File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,13 +244,14 @@ def get_prints_by_spool(spool_id: int):
244244 Retrieves all print jobs that used a specific spool.
245245 """
246246 conn = sqlite3 .connect (db_config ["db_path" ])
247+ conn .row_factory = sqlite3 .Row
247248 cursor = conn .cursor ()
248249 cursor .execute ('''
249250 SELECT DISTINCT p.* FROM prints p
250251 JOIN filament_usage f ON p.id = f.print_id
251252 WHERE f.spool_id = ?
252253 ''' , (spool_id ,))
253- prints = cursor .fetchall ()
254+ prints = [ dict ( row ) for row in cursor .fetchall ()]
254255 conn .close ()
255256 return prints
256257
@@ -264,9 +265,9 @@ def get_filament_for_slot(print_id: int, ams_slot: int):
264265 WHERE print_id = ? AND ams_slot = ?
265266 ''' , (print_id , ams_slot ))
266267
267- results = cursor .fetchone ()
268+ row = cursor .fetchone ()
268269 conn .close ()
269- return results
270+ return dict ( row ) if row else None
270271
271272def _ensure_layer_tracking_entry (print_id : int ):
272273 conn = sqlite3 .connect (db_config ["db_path" ])
You can’t perform that action at this time.
0 commit comments