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 { .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); border-bottom: 1px solid var(--bs-cmp-border);
flex: 0 0 auto; 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 { .bs-cmp-nav__title {
@ -10252,43 +10268,58 @@ html.login-page--paused .login-page__flare {
font-weight: 700; font-weight: 700;
letter-spacing: 0.02em; letter-spacing: 0.02em;
color: #f1f5f9; 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 { .bs-cmp-nav__hint {
margin-top: 2px; display: none;
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;
} }
.bs-cmp-nav__legend,
.bs-cmp-nav__stats { .bs-cmp-nav__stats {
display: inline-grid; display: inline-grid;
grid-template-columns: repeat(3, minmax(1.6em, auto)); grid-template-columns: 2.6em 2.6em 2.8em;
gap: 2px 6px; gap: 2px;
justify-items: end; justify-items: end;
align-items: center; align-items: center;
flex: 0 0 auto; flex: 0 0 auto;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
} }
.bs-cmp-nav__legend {
margin: 0;
font-size: 10px;
font-weight: 700;
}
.bs-cmp-nav__num { .bs-cmp-nav__num {
font-size: 11px; font-size: 11px;
font-weight: 700; font-weight: 700;
line-height: 1; line-height: 1;
color: #475569; color: #475569;
opacity: 0.55; opacity: 0.55;
white-space: nowrap;
}
.bs-cmp-nav__legend .bs-cmp-nav__num {
font-size: 10px;
} }
.bs-cmp-nav__num--fail.is-hot { .bs-cmp-nav__num--fail.is-hot {
@ -10304,7 +10335,6 @@ html.login-page--paused .login-page__flare {
.bs-cmp-nav__num--rate { .bs-cmp-nav__num--rate {
color: #93c5fd; color: #93c5fd;
opacity: 0.95; opacity: 0.95;
min-width: 2.6em;
} }
.bs-cmp-nav__list { .bs-cmp-nav__list {

View file

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