Exclude added from fail counts and tighten the sheet nav header.

Derive fail from missing+mismatch only, recompute pass rate accordingly, and put check-item count on one row aligned with fail/success/%.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-18 10:50:29 +08:00
parent bb00ec91f4
commit c7539e379d
2 changed files with 78 additions and 39 deletions

View file

@ -10242,9 +10242,25 @@ html.login-page--paused .login-page__flare {
}
.bs-cmp-nav__head {
padding: 10px 12px 8px;
display: grid;
grid-template-columns: 8px minmax(0, 1fr) auto;
align-items: center;
gap: 0 8px;
padding: 8px 10px;
border-bottom: 1px solid var(--bs-cmp-border);
flex: 0 0 auto;
min-height: 36px;
}
.bs-cmp-nav__dot--spacer {
visibility: hidden;
}
.bs-cmp-nav__head-main {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.bs-cmp-nav__title {
@ -10252,43 +10268,58 @@ html.login-page--paused .login-page__flare {
font-weight: 700;
letter-spacing: 0.02em;
color: #f1f5f9;
white-space: nowrap;
}
.bs-cmp-nav__count {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 1.35rem;
height: 1.2rem;
padding: 0 5px;
border-radius: 999px;
font-size: 10px;
font-weight: 700;
font-variant-numeric: tabular-nums;
line-height: 1;
color: #93c5fd;
background: rgba(59, 130, 246, 0.18);
border: 1px solid rgba(96, 165, 250, 0.35);
}
.bs-cmp-nav__hint {
margin-top: 2px;
font-size: 11px;
color: var(--bs-cmp-muted);
line-height: 1.35;
}
.bs-cmp-nav__legend {
display: grid;
grid-template-columns: repeat(3, minmax(1.6em, auto));
gap: 4px 6px;
justify-items: end;
margin-top: 6px;
margin-left: auto;
width: fit-content;
font-size: 10px;
font-weight: 700;
display: none;
}
.bs-cmp-nav__legend,
.bs-cmp-nav__stats {
display: inline-grid;
grid-template-columns: repeat(3, minmax(1.6em, auto));
gap: 2px 6px;
grid-template-columns: 2.6em 2.6em 2.8em;
gap: 2px;
justify-items: end;
align-items: center;
flex: 0 0 auto;
font-variant-numeric: tabular-nums;
}
.bs-cmp-nav__legend {
margin: 0;
font-size: 10px;
font-weight: 700;
}
.bs-cmp-nav__num {
font-size: 11px;
font-weight: 700;
line-height: 1;
color: #475569;
opacity: 0.55;
white-space: nowrap;
}
.bs-cmp-nav__legend .bs-cmp-nav__num {
font-size: 10px;
}
.bs-cmp-nav__num--fail.is-hot {
@ -10304,7 +10335,6 @@ html.login-page--paused .login-page__flare {
.bs-cmp-nav__num--rate {
color: #93c5fd;
opacity: 0.95;
min-width: 2.6em;
}
.bs-cmp-nav__list {

View file

@ -814,12 +814,18 @@ export function BizComparePage() {
diff_count?: number;
removed?: number;
changed?: number;
}) =>
Number(
c.fail_count ??
c.diff_count ??
Number(c.removed || 0) + Number(c.changed || 0),
);
added?: number;
}) => {
// Always derive from removed+changed so "新增" never counts as fail
// (legacy diff_count used to include added).
if (c.removed !== undefined || c.changed !== undefined) {
return Number(c.removed || 0) + Number(c.changed || 0);
}
if (c.fail_count !== undefined) return Number(c.fail_count || 0);
const legacy = Number(c.diff_count || 0);
const added = Number(c.added || 0);
return Math.max(0, legacy - added);
};
const sheetSuccessOf = (c: { success_count?: number; unchanged?: number }) =>
Number(c.success_count ?? c.unchanged ?? 0);
@ -832,8 +838,9 @@ export function BizComparePage() {
changed?: number;
success_count?: number;
unchanged?: number;
added?: number;
}) => {
if (c.pass_rate !== undefined && c.pass_rate !== null) return Number(c.pass_rate);
// Always recompute from fail/success so added never skews pass rate
const fail = sheetFailOf(c);
const ok = sheetSuccessOf(c);
const judged = fail + ok;
@ -865,7 +872,6 @@ export function BizComparePage() {
return String(a.metric_id).localeCompare(String(b.metric_id));
});
}, [summary.sheet_cards]);
const sheetFailCount = sheetCards.filter((c) => sheetFailOf(c) > 0).length;
const activeSheetCard = sheetCards.find((c) => c.metric_id === resultSheetId) || sheetCards[0];
const activeFail = sheetFailOf(activeSheetCard || {});
const activeSuccess = sheetSuccessOf(activeSheetCard || {});
@ -2275,16 +2281,19 @@ export function BizComparePage() {
<div className="bs-cmp-board__body">
<aside className="bs-cmp-nav" aria-label={t("bizCompare.sheetNavTitle")}>
<div className="bs-cmp-nav__head">
<div className="bs-cmp-nav__title">{t("bizCompare.sheetNavTitle")}</div>
<div className="bs-cmp-nav__hint">
{t("bizCompare.sheetNavHint", {
n: String(sheetCards.length || runSheets.length),
})}
{sheetFailCount > 0
? ` · ${t("bizCompare.sheetFailCount", { n: String(sheetFailCount) })}`
: ""}
</div>
<div className="bs-cmp-nav__legend" aria-hidden>
<span className="bs-cmp-nav__dot bs-cmp-nav__dot--spacer" aria-hidden />
<span className="bs-cmp-nav__head-main">
<span className="bs-cmp-nav__title">{t("bizCompare.sheetNavTitle")}</span>
<span
className="bs-cmp-nav__count"
title={t("bizCompare.sheetNavHint", {
n: String(sheetCards.length || runSheets.length),
})}
>
{sheetCards.length || runSheets.length}
</span>
</span>
<span className="bs-cmp-nav__legend" aria-hidden>
<span
className="bs-cmp-nav__num bs-cmp-nav__num--fail is-hot"
title={t("bizCompare.kindFail")}
@ -2303,7 +2312,7 @@ export function BizComparePage() {
>
%
</span>
</div>
</span>
</div>
<div className="bs-cmp-nav__list" role="tablist">
{(sheetCards.length