- C1 (issue 1): over target follows VISUAL ticket hours, not the timer. - C2 (issue 24): a Q.C. reject always needs a reason; accept needs an NCR number after a reject without one. - C3 (issue 25): an incomplete unit ITP blocks filing. - C4 (issue 27): prints open the print dialog on the page, no new tab. - C5 (issue 31): filing is blocked while VISUAL shows a work order open; the feed sets vclosed on VISUAL packets. - C6 (issue 8): the data book leaves out the history pages. - C7 (issue 18): the supervisor approves each received short; accept and filing wait for it. - C8 (issue 23): per-department checklists, edited by the department supervisor or Admin, frozen at START. - C9 (issue 32): Q.C. and Clerical may run the stamp check. - C10 (issue 33): the PM screen and reports are for PS-ProjectMgmt and Admin only. - C11 (issue 36): the Stall screen lists the packets assigned to the welder, at the supervisor's stall. Migration 0011. Docs: PLAN (also issue 9 confirmed, issue 4 asked), POLICY, SECURITY, SCHEMA, FEED, README, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
"""Change C1 (Gitea issue 1): "over target" is decided by the VISUAL ticket hours against the work-order target, not
|
|
by the station timer. A packet with no ticket hours is not over target. No database: a stub report feeds the PM
|
|
hours tables."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from packetstation.domain import pm
|
|
|
|
|
|
class StubReport:
|
|
def __init__(self, hours: dict[int, dict[str, float]]) -> None:
|
|
self._h = hours
|
|
self.cards = [
|
|
{"id": pid, "status": "station", "dept": {"code": "WP"}, "unit": {"number": f"L1-00{pid}"}, "op": "10"}
|
|
for pid in hours
|
|
]
|
|
|
|
def hours(self) -> dict[int, dict[str, float]]:
|
|
return self._h
|
|
|
|
def dept_short(self, code: str) -> str:
|
|
return code
|
|
|
|
|
|
def h(timer: float, ticket: float, target: float) -> dict[str, float]:
|
|
return {"timer_h": timer, "ticket_h": ticket, "target_h": target}
|
|
|
|
|
|
WORLD = {
|
|
1: h(9.0, 0.0, 4.0), # timer over, no tickets: not over
|
|
2: h(1.0, 5.5, 4.0), # tickets over, timer under: over
|
|
3: h(9.0, 3.0, 4.0), # timer over, tickets under: not over
|
|
4: h(0.0, 2.0, 0.0), # no target: never over
|
|
}
|
|
|
|
|
|
def tables() -> dict[str, dict[str, Any]]:
|
|
rep: Any = StubReport(WORLD)
|
|
return {t["key"]: t for t in pm.hours_tables(rep)}
|
|
|
|
|
|
def test_is_over_reads_the_tickets() -> None:
|
|
assert [pid for pid, x in WORLD.items() if pm.is_over(x)] == [2]
|
|
|
|
|
|
def test_over_table_lists_ticket_overs_only() -> None:
|
|
over = tables()["hours_over"]
|
|
assert over["head"][-1] == "Over by (tickets)"
|
|
assert [r["pid"] for r in over["rows"]] == [2]
|
|
assert over["rows"][0]["cells"][-1] == "+1.5 h"
|
|
|
|
|
|
def test_group_counts_and_heads() -> None:
|
|
dept = tables()["hours_dept"]
|
|
assert dept["head"][-3:] == ["Ticket variance h", "Ticket h / target", "Over target (tickets)"]
|
|
cells = dept["rows"][0]["cells"]
|
|
assert cells[-1] == "1" # one packet over on its tickets
|
|
# ticket 8.5 against target 12: under, so the group is not flagged and the ratio is the tickets'
|
|
assert cells[-2] == "71%" and not dept["rows"][0]["flag"]
|
|
|
|
|
|
def test_over_target_count() -> None:
|
|
rep: Any = StubReport(WORLD)
|
|
assert pm.over_target_count(rep) == 1
|