Remove estimated remaining decay, use audit values directly
Build and push image / build (push) Successful in 1m6s

Replace burn-rate estimation (linear decay between audits) with actual
last audit values. Remaining is now always the last weigh-in value or
original weight if no audits exist — no more speculative daily decay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 19:12:09 -04:00
parent 538e5079ab
commit fc7b3d5de2
9 changed files with 37 additions and 47 deletions
+6 -7
View File
@@ -38,8 +38,8 @@ export function ProductDetail({
const bin = data.bins.find((b) => b.id === item.binId);
const cfg = TYPES.find((t) => t.id === item.type);
const product = data.products.find((p) => p.id === item.productId);
const pctRemaining = helpers.pctRemaining(item, getToday(getStoredTimezone()));
const est = helpers.estimatedRemaining(item, getToday(getStoredTimezone()));
const pctRemaining = helpers.pctRemaining(item);
const rem = helpers.remaining(item);
const last = helpers.lastAudit(item);
const overdue = helpers.auditOverdue(item, getToday(getStoredTimezone()));
const sinceCheck = helpers.daysSinceCheck(item, getToday(getStoredTimezone()));
@@ -293,12 +293,12 @@ export function ProductDetail({
}}
>
<div className="smallcaps" style={{ color: "var(--ink-3)" }}>
{item.kind === "discrete" ? "Units remaining" : "Estimated remaining"}
{item.kind === "discrete" ? "Units remaining" : "Remaining"}
</div>
<div style={{ fontFamily: "var(--mono)", fontSize: 13 }}>
{item.kind === "discrete"
? `${item.countLastAudit ?? item.countOriginal} of ${item.countOriginal}`
: `${est.toFixed(2)} of ${item.weight} ${cfg?.unit ?? "g"}`}
: `${rem.toFixed(2)} of ${item.weight} ${cfg?.unit ?? "g"}`}
<span style={{ color: "var(--ink-3)", marginLeft: 8 }}>
{Math.round(pctRemaining * 100)}%
</span>
@@ -327,8 +327,7 @@ export function ProductDetail({
fontStyle: "italic",
}}
>
Estimated by linear decay since last {last.mode} on {fmt.dateShort(last.date, getStoredTimezone())} ({last.value.toFixed(2)}
{cfg?.unit}). Re-audit to update.
Last {last.mode} on {fmt.dateShort(last.date, getStoredTimezone())}
</div>
)}
{item.containerWeight != null && last && (
@@ -340,7 +339,7 @@ export function ProductDetail({
fontStyle: "italic",
}}
>
Expected container total: {((item.containerWeight - item.weight) + est).toFixed(2)}g
Expected container total: {((item.containerWeight - item.weight) + rem).toFixed(2)}g
</div>
)}
</div>