Import the remade decks and recommend one card per job #93

Merged
an.di merged 2 commits from adilallo/feature/CR-284-remade-decks into main 2026-11-04 22:59:19 +00:00
2 changed files with 130 additions and 27903 deletions
Showing only changes of commit c569482706 - Show all commits

No files matched your search

+126 -27880
View File
File diff suppressed because it is too large. Load diff
+4 -23
View File
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
import path from "node:path"; import path from "node:path";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { DECK_IDS } from "../../lib/create/deckTypes"; import { DECK_IDS } from "../../lib/create/deckTypes";
import type { DeckId, RecommendedCard } from "../../lib/create/deckTypes"; import type { DeckId } from "../../lib/create/deckTypes";
import { deckData, recommendDeck } from "../../lib/create/deckRecommend"; import { deckData, recommendDeck } from "../../lib/create/deckRecommend";
import { variantsOf } from "../../lib/create/reviewProfiles"; import { variantsOf } from "../../lib/create/reviewProfiles";
import type { ReviewProfile } from "../../lib/create/reviewProfiles"; import type { ReviewProfile } from "../../lib/create/reviewProfiles";
@@ -19,25 +19,6 @@ function readJson<T>(rel: string): T {
const profiles = readJson<ReviewProfile[]>("data/create/profiles/real-group-profiles.json"); const profiles = readJson<ReviewProfile[]>("data/create/profiles/real-group-profiles.json");
const founders = readJson<ReviewProfile[]>("data/create/profiles/one-member-founders.json"); const founders = readJson<ReviewProfile[]>("data/create/profiles/one-member-founders.json");
function compact(card: RecommendedCard) {
const reason =
card.reason.kind === "added"
? `added:${card.reason.answer}`
: card.reason.kind === "opened"
? `opened:${card.reason.answer}`
: card.reason.answer
? `fit+${card.reason.answer}`
: "fit";
return {
id: card.id,
tag: card.tag,
tier: card.tier,
reason,
...(card.decidedBy ? { decidedBy: card.decidedBy } : {}),
...(card.alternative ? { alternative: card.alternative } : {}),
};
}
function picksFor(set: ReviewProfile[]) { function picksFor(set: ReviewProfile[]) {
return set.flatMap(variantsOf).map((variant) => ({ return set.flatMap(variantsOf).map((variant) => ({
profile: variant.profile, profile: variant.profile,
@@ -48,7 +29,7 @@ function picksFor(set: ReviewProfile[]) {
return [ return [
deck, deck,
{ {
shown: result.shown.map(compact), shown: result.shown.map((card) => card.id),
waiting: result.waiting.map((card) => card.id), waiting: result.waiting.map((card) => card.id),
}, },
]; ];
@@ -110,8 +91,8 @@ function chosenCards(documentKey: string): { total: number; ids: string[] } {
describe("real-group profiles", () => { describe("real-group profiles", () => {
it("matches the reviewed 2 Nov package run", () => { it("matches the reviewed 2 Nov package run", () => {
const expected = readJson<{ picks: unknown[] }>("tests/fixtures/profiles-picks.json"); const expected = readJson<unknown[]>("tests/fixtures/profiles-picks.json");
expect(picksFor([...profiles, ...founders])).toEqual(expected.picks); expect(picksFor([...profiles, ...founders])).toEqual(expected);
}); });
it("reports how often row order settled a pick", () => { it("reports how often row order settled a pick", () => {