@local-civics/mgmt-ui 0.1.234 → 0.1.235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3344,7 +3344,19 @@ const Pathway = (props) => {
|
|
|
3344
3344
|
const numberOfStudents = props.students.length;
|
|
3345
3345
|
const numberOfBadgesEarned = numberOfStudents > 0 ? props.students.filter((u) => u.isComplete).length : 0;
|
|
3346
3346
|
const criteria = props.criteria || {};
|
|
3347
|
-
const
|
|
3347
|
+
const parentById = new Map((props.allCategories || []).map((c) => [c.categoryId, c.parentCategoryId]));
|
|
3348
|
+
const depthOf = (id) => {
|
|
3349
|
+
let depth = 0;
|
|
3350
|
+
let current = id;
|
|
3351
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3352
|
+
while (parentById.get(current) && !seen.has(current)) {
|
|
3353
|
+
seen.add(current);
|
|
3354
|
+
current = parentById.get(current);
|
|
3355
|
+
depth++;
|
|
3356
|
+
}
|
|
3357
|
+
return depth;
|
|
3358
|
+
};
|
|
3359
|
+
const criteriaCategories = (props.categories || []).filter((c) => criteria[c.categoryId] !== void 0).sort((a, b) => depthOf(a.categoryId) - depthOf(b.categoryId));
|
|
3348
3360
|
const rootCategoryIds = new Set(
|
|
3349
3361
|
(props.allCategories || []).filter((c) => !c.parentCategoryId).map((c) => c.categoryId)
|
|
3350
3362
|
);
|