Summary
setActiveTray function has inverted logic - skips updating active_tray field
Environment
- OpenSpoolMan version: latest (from ghcr.io/drndos/openspoolman)
- Deployment: ☑ Docker
- Browser: Any
- DISABLE_MISMATCH_WARNING set?: ☐ Yes ☑ No
Additional context
The setActiveTray function in spoolman_service.py has inverted logic in its condition check. It uses == instead of !=, causing it to skip updates when the tray is already assigned.
Steps to Reproduce:
- Assign a spool to external spool (tray 254) using "Fill" in OpenSpoolMan - works
- Start a print
- Try to reassign a different spool using "Fill" - shows "Skipping set active tray" in logs and fails to update SpoolMan
Expected Behavior:
Should update the active_tray field in SpoolMan when assigning a new spool to the tray
Actual Behavior:
Shows "Skipping set active tray" and doesn't update the SpoolMan database
Suggested Fix:
In spoolman_service.py, change line 179 from:
if not spool_extra.get("active_tray") or json.loads(spool_extra.get("active_tray")) == trayUid(ams_id, tray_id):
To:
if not spool_extra.get("active_tray") or json.loads(spool_extra.get("active_tray")) != trayUid(ams_id, tray_id):
The condition logic is inverted - it should update when the value is DIFFERENT (!=), not when it's the same (==).
Summary
setActiveTray function has inverted logic - skips updating active_tray field
Environment
Additional context
The setActiveTray function in spoolman_service.py has inverted logic in its condition check. It uses == instead of !=, causing it to skip updates when the tray is already assigned.
Steps to Reproduce:
Expected Behavior:
Should update the active_tray field in SpoolMan when assigning a new spool to the tray
Actual Behavior:
Shows "Skipping set active tray" and doesn't update the SpoolMan database
Suggested Fix:
In spoolman_service.py, change line 179 from:
if not spool_extra.get("active_tray") or json.loads(spool_extra.get("active_tray")) == trayUid(ams_id, tray_id):To:
if not spool_extra.get("active_tray") or json.loads(spool_extra.get("active_tray")) != trayUid(ams_id, tray_id):The condition logic is inverted - it should update when the value is DIFFERENT (!=), not when it's the same (==).