From d14fce013c0dae82d4ab2da8771620baaf8bb07c Mon Sep 17 00:00:00 2001 From: Donkie Date: Fri, 14 Jul 2023 19:04:54 +0200 Subject: [PATCH] Fixed spools with unset archive state being hidden --- spoolman/database/spool.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spoolman/database/spool.py b/spoolman/database/spool.py index 17c5eb5..029c336 100644 --- a/spoolman/database/spool.py +++ b/spoolman/database/spool.py @@ -109,7 +109,13 @@ async def find( if lot_nr is not None: stmt = stmt.where(models.Spool.lot_nr.ilike(f"%{lot_nr}%")) if not allow_archived: - stmt = stmt.where(models.Spool.archived != True) # noqa: E712 + # Since the archived field is nullable, and default is false, we need to check for both false or null + stmt = stmt.where( + sqlalchemy.or_( + models.Spool.archived.is_(False), # noqa: FBT003 + models.Spool.archived.is_(None), + ), + ) rows = await db.execute(stmt) return list(rows.scalars().all())