Filter seniority by a range of rungs and a track: level_from, level_to, track; From, To and Track in the rail (WP B)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 13:03:31 +02:00
1 parent ae978594b4
commit 4e390d97ca
6 files changed
+207 -71

No files matched your search

+8 -3
View File
@@ -41,7 +41,7 @@ from fastapi import APIRouter, HTTPException, Request
from fastapi.responses import HTMLResponse, RedirectResponse
from fastapi.templating import Jinja2Templates
from app.models import REMOTE, STATUSES
from app.models import LADDER, REMOTE, RUNGS, STATUSES
from app.web.deps import StoreDep
_ROOT = Path(__file__).resolve().parents[2]
@@ -103,6 +103,10 @@ COUNTRY_OPTIONS = [(c, c.upper()) for c in sorted(ADZUNA_COUNTRIES)]
REGION_OPTIONS = sorted(PLATSBANKEN_REGIONS.items(), key=lambda kv: kv[1])
#: The ATS hosts `plugins.ats` reads, for the Follow and Set board selects.
HOST_OPTIONS = list(HOSTS.items())
#: The seniority ladder as `roles.js` reads it: the rungs in order, and each
#: level's rung (an index into them) and track, so the words are `app.models`'
#: alone. The page carries it as JSON.
LADDER_JSON = {"rungs": list(RUNGS), "levels": {k: list(v) for k, v in LADDER.items()}}
def asset(path: str) -> str:
@@ -133,7 +137,8 @@ def page(request: Request, name: str, **context: object) -> HTMLResponse:
@router.get("/", response_class=HTMLResponse)
def roles(request: Request) -> HTMLResponse:
return page(request, "roles.html", functions=FUNCTION_OPTIONS,
remote_options=REMOTE_OPTIONS, pay_options=PAY_OPTIONS, role=None)
remote_options=REMOTE_OPTIONS, pay_options=PAY_OPTIONS,
ladder=LADDER_JSON, role=None)
@router.get("/roles/{uid}", response_class=HTMLResponse)
@@ -148,7 +153,7 @@ def role(request: Request, uid: str, store: StoreDep) -> HTMLResponse:
raise HTTPException(404, f"no such role: {uid}")
return page(request, "roles.html", functions=FUNCTION_OPTIONS,
remote_options=REMOTE_OPTIONS, pay_options=PAY_OPTIONS,
role=found, active_path="/")
ladder=LADDER_JSON, role=found, active_path="/")
@router.get("/applications", response_class=HTMLResponse)