1.0 KiB
1.0 KiB
Frontend Compute Shift Plan
Targeted Calculations
Resource History (migrated to frontend helpers)
ou_pctavailability_pct- status percentages:
prd_pctsby_pctudt_pctsdt_pctegt_pctnst_pct
These are now computed by frontend/src/core/compute.js via:
buildResourceKpiFromHourscalcOuPctcalcAvailabilityPctcalcStatusPct
Parity Rules
- Rounding rule
- one decimal place, identical to backend (
round(..., 1))
- Formula rule
- OU%:
PRD / (PRD + SBY + UDT + SDT + EGT) - Availability%:
(PRD + SBY + EGT) / (PRD + SBY + EGT + SDT + UDT + NST) - Status%:
status_hours / total_hours
- Zero denominator rule
- all percentages return
0
- Data compatibility rule
- backend keeps existing fields to preserve API compatibility
- frontend recomputes display values from hours for deterministic parity
Validation
- Python backend formula baseline:
mes_dashboard.services.resource_history_service - Frontend parity check:
tests/test_frontend_compute_parity.py