| 626 | |
| 627 | /** Registry stats, for /plan-tune stats */ |
| 628 | export function getRegistryStats() { |
| 629 | const all = Object.values(QUESTIONS as Record<string, QuestionDef>); |
| 630 | const bySkill: Record<string, number> = {}; |
| 631 | const byCategory: Record<string, number> = {}; |
| 632 | let oneWay = 0; |
| 633 | let twoWay = 0; |
| 634 | for (const q of all) { |
| 635 | bySkill[q.skill] = (bySkill[q.skill] ?? 0) + 1; |
| 636 | byCategory[q.category] = (byCategory[q.category] ?? 0) + 1; |
| 637 | if (q.door_type === 'one-way') oneWay++; |
| 638 | else twoWay++; |
| 639 | } |
| 640 | return { |
| 641 | total: all.length, |
| 642 | one_way: oneWay, |
| 643 | two_way: twoWay, |
| 644 | by_skill: bySkill, |
| 645 | by_category: byCategory, |
| 646 | }; |
| 647 | } |