commit 2a4c2f251582019c4cb674a03cbf24d14c514184
parent 21c1d2544efefaf11bc79459971b8ad234ede1b0
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 05:08:55 -0400
umtool: a drafts card names up to three kinds of field before it says "N more"
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/umtool/lib/inbox/drafts.mjs b/umtool/lib/inbox/drafts.mjs
@@ -21,12 +21,9 @@ export function draftsWhy(rows) {
const byLabel = new Map();
for (const r of rows) byLabel.set(r.label, (byLabel.get(r.label) ?? 0) + 1);
const labels = [...byLabel.keys()];
- const head =
- labels.length === 1
- ? `${labels[0]} draft`
- : labels.length === 2
- ? `${labels[0]} and ${labels[1]} drafts`
- : `${labels[0]}, ${labels[1]} and ${labels.length - 2} more drafts`;
+ const named = labels.length <= 3 ? labels : [...labels.slice(0, 2), `${labels.length - 2} more`];
+ const list = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named[named.length - 1]}`;
+ const head = `${list} draft${labels.length === 1 ? "" : "s"}`;
const n = rows.length;
const models = [...new Set(rows.map((r) => r.drafted?.model).filter(Boolean))];
const edited = rows.filter((r) => r.state === "edited").length;
diff --git a/umtool/lib/inbox/drafts.test.mjs b/umtool/lib/inbox/drafts.test.mjs
@@ -33,6 +33,10 @@ test("the sentence names the kinds of field and the models", () => {
"Narration and on-screen text drafts · 2 fields · by qwen3:8b, claude-sonnet-5-5",
);
assert.equal(
+ draftsWhy([row("a", "narration", "unreviewed"), row("b", "teaser lines", "unreviewed"), row("c", "flips", "unreviewed")]),
+ "Narration, teaser lines and flips drafts · 3 fields · by qwen3:8b",
+ );
+ assert.equal(
draftsWhy([row("a", "narration", "unreviewed"), row("b", "teaser lines", "unreviewed"), row("c", "flips", "unreviewed"), row("d", "threads", "unreviewed")]),
"Narration, teaser lines and 2 more drafts · 4 fields · by qwen3:8b",
);