diff --git a/src/app/milestones/page.tsx b/src/app/milestones/page.tsx index 16cf0af9..cda204a8 100644 --- a/src/app/milestones/page.tsx +++ b/src/app/milestones/page.tsx @@ -27,7 +27,10 @@ export default async function MilestonesPage() {
{milestones.map((m) => { - const pct = m.distributed / m.budget; + const hasBudget = m.budget > 0; + const pct = hasBudget ? m.distributed / m.budget : 0; + const isOverDistributed = hasBudget && m.distributed > m.budget; + const clampedPct = Math.min(pct, 1); return (
{m.name}
@@ -46,7 +49,13 @@ export default async function MilestonesPage() { {formatCurrency(m.distributed, m.asset)} of{" "} {formatCurrency(m.budget, m.asset)} - {formatPercent(pct)} + + {!hasBudget + ? "Not yet funded" + : isOverDistributed + ? `${formatPercent(pct)} (over-distributed)` + : formatPercent(clampedPct)} +

{m.completedCount} of {m.issueCount} issues complete