From a896788cc5f979fba0b45d3dd4602c787c598cbd Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Fri, 8 Sep 2023 11:31:41 -0600 Subject: [PATCH] Also list KSAs by Category --- theme/reports/ksa.html | 4 +++- theme/reports/ksa.mjs | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/theme/reports/ksa.html b/theme/reports/ksa.html index 592a355..268925c 100644 --- a/theme/reports/ksa.html +++ b/theme/reports/ksa.html @@ -12,9 +12,11 @@ This is not a report on your progress, but rather what you would have covered if you had worked every exercise available.

- +
+

All KSAs by Category

+
diff --git a/theme/reports/ksa.mjs b/theme/reports/ksa.mjs index 3cc786e..1409b2d 100644 --- a/theme/reports/ksa.mjs +++ b/theme/reports/ksa.mjs @@ -24,6 +24,20 @@ async function init() { let puzzles = state.Puzzles() for (let puzzle of puzzles) { await puzzle.Populate().catch(x => {}) + } + + doing("Filling tables") + let KSAsByCategory = {} + for (let puzzle of puzzles) { + let KSAs = KSAsByCategory[puzzle.Category] + if (!KSAs) { + KSAs = new Set() + KSAsByCategory[puzzle.Category] = KSAs + } + for (let KSA of (puzzle.KSAs || [])) { + KSAs.add(KSA) + } + for (let tbody of document.querySelectorAll("tbody")) { let row = puzzlerowTemplate.content.cloneNode(true) row.querySelector(".category").textContent = puzzle.Category @@ -34,6 +48,20 @@ async function init() { } } + doing("Filling KSAs By Category") + for (let div of document.querySelectorAll(".KSAsByCategory")) { + for (let category of state.Categories()) { + let KSAs = [...KSAsByCategory[category]] + KSAs.sort() + + div.appendChild(document.createElement("h3")).textContent = category + let ul = div.appendChild(document.createElement("ul")) + for (let k of KSAs) { + ul.appendChild(document.createElement("li")).textContent = k + } + } + } + doing() }