Braised-food equipment technician - the repair-or-replace calculator, a small tool: the repair quote, the cumulative repair share, and the daily downtime cost, three accounts in one pass
Build a single-file HTML repair-or-replace calculator for a
braised-food chain's equipment maintenance role - the machine broke
again, the shop quoted a price, and the repair-or-replace call needs
three accounts settled together first.
Inputs (typed on the page, one ledger per machine):
- Unit file: name, purchase price, years in service
- This repair: quote, and the service life the shop commits to after
repair (committed remaining life - entering "not stated" is allowed;
treated as [conservative default: 6 months] and labeled in results)
- Repair history: the unit's cumulative repair count and spend
(recorded line by line in the ledger)
- Downtime impact: the average daily cost when this unit is down
(spoilage + degraded sales; the basis stated on the page)
- Waiting days: average parts-or-visit wait for the repair option,
and delivery-plus-install days for the replacement option
Computation and output:
- Decision table (one per unit):
a. This-time ratio: repair quote / replacement cost
b. Cumulative share: historical repair spend / purchase price
c. Pessimistic case: if the same fault recurs once within the
committed life, both repairs combined / replacement cost
d. Downtime cost: daily impact x waiting days, computed for both
options - so "pricier but faster" and "cheaper but slower"
become comparable
- Three-color advice:
Green - repair: ratio under [X%] and this failure mode is a first
occurrence
Yellow - repair, but quote a replacement now: ratio acceptable but
cumulative share over [Y%], or the same failure mode recurred once
already
Red - replace: repair quote over [X%] of replacement, or the same
failure mode recurred 2+ times, or the pessimistic case exceeds
replacement
- One explanatory line per color, citing the numbers - never a color
without its reason
Implementation requirements:
- Single file, no external dependencies, no network requests;
localStorage holds the ledger across refreshes
- Thresholds (X, Y, recurrence count, conservative default life) are
all page-adjustable parameters
- Print-friendly, one machine per A4 page
- No accounts, no cloud sync
Notes for the coding agent:
- "Same failure mode" is judged from a fault-category field in the
ledger; every repair entry requires the category (dropdown:
refrigeration / heating / seals / electrical / other)
- The downtime-impact field carries a basis hint: "don't compare
repair-price differences alone - a display case down one day often
loses more stock than the repair costs"
Why it is written this way
The losing pattern is fixed: compare only this quote. The shop says three hundred to fix, replacement runs three thousand, fix it - and three months later another three hundred, and another. The cumulative-share and failure-mode-recurrence fields exist precisely for that blind spot: every single repair is cheap, the total has long since overrun; an old cooler on its third door gasket never had a gasket problem. The yellow band is deliberate - "repair this one, start quoting now" - because real decisions are rarely binary: mid-season is the wrong time to swap a case, but the quote must start now or the wait simply repeats after the repair.
Daily downtime cost carries its own account because the deli makes it necessary: a display case down for a day loses spoilage plus degraded sales that often exceed the repair price itself. "Cheap but a week on parts" versus "expensive but installed tomorrow" only compares through daily impact times waiting days - and the tool doesn't make the call, it just guarantees both accounts sit on the table next to the quote. The mandatory fault-category dropdown turns "the same thing broke again" from chat-history archaeology into a field a page can count.
Allowing "not stated" for committed life is an honesty exit. Shops routinely decline to commit; force the user to fill a number and they will invent one, and the whole calculation stands on fiction. Substituting the conservative default and labeling it in the result beats false data - at minimum, the reader knows which part is a guess.
Variables
| Variable | Notes |
|---|---|
| Thresholds X / Y | The ratio and cumulative-share red lines - set per equipment class, strictest for display cases |
| Recurrence lines | Yellow at 1, red at 2 as the baseline; consumable-failure classes (seals) may relax one notch |
| Conservative default life | The substitute value when no commitment is given, default 6 months, always labeled in results |