Add priority flag to jobs

- Migration 0010: priority BOOLEAN NOT NULL DEFAULT 0 on print_jobs
- Priority jobs sort above normal jobs in the list
- Checkbox in Add Job modal; warning icon in list; badge on detail page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Hohenberg
2026-06-18 22:17:55 +02:00
parent e7df987e5b
commit 6f85cd5d1c
5 changed files with 41 additions and 2 deletions

View File

@@ -135,7 +135,7 @@ def jobs_page(request: Request, q: str = "", db: Session = Depends(get_db)):
return templates.TemplateResponse("jobs.html", {
"request": request,
"active": "jobs",
"jobs": query.order_by(PrintJob.created_at.desc()).all(),
"jobs": query.order_by(PrintJob.priority.desc(), PrintJob.created_at.desc()).all(),
"q": q,
"printers": db.query(Printer).order_by(Printer.name).all(),
"filaments": db.query(Filament).order_by(Filament.material, Filament.color).all(),
@@ -153,6 +153,7 @@ async def create_job(
customer: str = Form(""),
job_material: str = Form(""),
job_color: str = Form(""),
priority: str = Form(""),
bracket_id: str = Form(""),
amount: int = Form(1),
notes: str = Form(""),
@@ -193,6 +194,7 @@ async def create_job(
customer=customer_str,
job_material=job_material or None,
job_color=job_color or None,
priority=bool(priority),
notes=notes.strip() or None,
)
db.add(job)