Sort jobs: internal always last within each priority stratum
Order: priority customer > priority internal > normal customer > normal internal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -155,13 +155,14 @@ def jobs_page(request: Request, q: str = "", bracket_id: str = "", show_all: str
|
||||
or_(~PrintJob.status.in_(finished), PrintJob.created_at >= cutoff)
|
||||
)
|
||||
|
||||
# Sort: printing → queued → rest, then priority, then oldest first
|
||||
# Sort: printing → queued → rest, then priority flag, then internal last, then oldest first
|
||||
status_order = case(
|
||||
(PrintJob.status == JobStatus.printing, 0),
|
||||
(PrintJob.status == JobStatus.queued, 1),
|
||||
else_=2,
|
||||
)
|
||||
jobs = query.order_by(status_order, PrintJob.priority.desc(), PrintJob.created_at.asc()).all()
|
||||
internal_last = case((PrintJob.customer == "internal", 1), else_=0)
|
||||
jobs = query.order_by(status_order, PrintJob.priority.desc(), internal_last, PrintJob.created_at.asc()).all()
|
||||
|
||||
stl_files = list_stl_files()
|
||||
stl_cache = get_cache_map(stl_files, db)
|
||||
|
||||
Reference in New Issue
Block a user