Files
Cato 9a5856b031 Content inventory: the course counted from its own material (#449)
* wip(inventory): content inventory, command and manage page

* docs(inventory): changelog and HEIDI.md
2026-12-03 11:23:12 +01:00

31 lines
1.7 KiB
TypeScript

/**
* `pnpm run inventory` — what the course holds, counted from the material
* (`lib/domain/inventory/inventory.ts`). `--json` prints the whole count.
* The same figures are on `/manage/content`.
*/
import { INVENTORY } from "../lib/domain/inventory/current.ts";
import { questionsPerWord, thin, THIN_TOPIC, type Count } from "../lib/domain/inventory/inventory.ts";
if (process.argv.includes("--json")) {
console.log(JSON.stringify(INVENTORY, null, 2));
} else {
const i = INVENTORY;
const rows = (title: string, counts: readonly Count[]) => console.log(`\n${title}\n${counts.map((c) => ` ${String(c.n).padStart(6)} ${c.id}`).join("\n")}`);
console.log(`Practice questions ${i.questions}`);
console.log(`Situations ${i.situations.scenes} in ${i.situations.domains.length} domains, ${i.situations.lines} lines`);
console.log(`Vocabulary ${i.vocabulary.words} words, ${i.vocabulary.withForms} with forms (${i.vocabulary.forms} forms), ${i.vocabulary.traps} traps`);
console.log(`Grammar ${i.grammar.topics} topics, ${i.grammar.examples} examples`);
console.log(`Reading texts ${i.reading}`);
console.log(`Listening sources ${i.listening}`);
console.log(`Questions per word ${questionsPerWord(i)}`);
rows("By what a question tests", i.bySkill);
rows("By kind of question", i.byKind);
rows("By where it comes from", i.bySource);
rows("By distance from the bridge language (1 like it, 3 different)", i.byLevel);
rows("Vocabulary by group", i.vocabulary.byGroup);
rows("Questions per grammar topic", i.grammar.perTopic);
const t = thin(i);
rows(`Thin: grammar topics under ${THIN_TOPIC} questions`, t.topics);
rows("Thin: skills under 2% of the questions", t.skills);
}