Expand description
The draft-entry editor’s service layer: cap math, candidate pools, and the page / slot / save operations the handler and templates consume.
Structs§
- CapState
- A draft’s cap position: how many slots are filled, what is left under the cap, and the average left per open slot.
- Editor
Page - The editor page: cap state, the nine rows, and whether the slate is read-only.
- Editor
Slot Row - One of the editor’s nine slot rows: what fills the slot and how it prices.
- Slot
Choice - One candidate for a slot’s pick list, with its price and pace.
Functions§
- choices
- The candidate list for one slot, salary-descending from the snapshot.
Omits players already picked into another slot; the current occupant of
slotappears markedis_picked. Defense choices carry the team abbr as the value key. - clear_
slot - Empty a slot. An absent draft is created then cleared (net no-op). Refuses on a locked slate.
- discard
- Delete the draft row, abandoning the in-progress lineup. Never refused: there is no committed data to protect.
- editor_
page - Open (or resume) the draft and assemble the editor page.
NotFoundwhen the slate is not published with salaried players. - remaining_
and_ per_ open - Remaining budget and the per-open-slot average. Negative remaining = over the cap.
- save
- Commit the draft as a real entry: upsert the
entriesrow, replace its nineentry_slots, and delete the draft row. Refuses when the lineup is incomplete or over the salary cap. - set_
slot - Place (or replace) a pick in a slot. Rejects an invalid pick (see
[
validate_pick]) and refuses on a locked slate.