fix(reporting): mark genuine ties on the compare "Best" tag

A row with more than one joint-best column is a real tie (e.g. two
scenarios upgrading the same 7 homes — an integer count, no rounding).
Show "Best · tie" on those tags so the shared Best reads as intentional,
and note in the caption that every column tying for best is tagged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-27 11:43:00 +00:00
parent dcb301a931
commit 194075c5b8

View file

@ -330,8 +330,8 @@ export function CompareClientArea({
</div>
<p className="mt-2.5 text-[0.75rem] text-gray-600">
The <span className="font-semibold text-[#0c6b4a]">Best</span> tag marks
the best value in each row no overall winner is crowned; trade-offs
stay visible.
the best value in each row or every column that ties for it. No overall
winner is crowned; trade-offs stay visible.
</p>
</div>
);
@ -375,6 +375,10 @@ function GroupRows({
best.clear();
}
}
// More than one joint-best column = a genuine tie (e.g. two scenarios
// upgrading the same 7 homes). Flag it on each tag so the reader knows
// the shared Best is intentional, not a bug.
const tie = best.size > 1;
// "before" cell: baseline has no scenario metric, so most rows show —.
const baselineCell =
row.label === "Average EPC after"
@ -397,7 +401,7 @@ function GroupRows({
>
{best.has(i) && (
<span className="mr-1.5 inline-flex items-center rounded bg-[#e9f4ef] px-1.5 py-0.5 align-middle text-[0.6rem] font-bold uppercase tracking-wide text-[#0c6b4a]">
Best
{tie ? "Best · tie" : "Best"}
</span>
)}
{row.render(v)}