Move constraint priority resolution from JS to server

This commit is contained in:
Ian Gulliver
2026-02-16 10:12:35 -08:00
parent 210f84c002
commit 4c487a251b
2 changed files with 30 additions and 13 deletions

View File

@@ -76,18 +76,9 @@ async function loadStudents() {
};
const allOveralls = {};
for (const s of students) {
const myC = constraints.filter(c => c.student_a_id === s.id);
const byPeer = {};
for (const c of myC) {
if (!byPeer[c.student_b_id]) byPeer[c.student_b_id] = {};
byPeer[c.student_b_id][c.level] = c;
}
allOveralls[s.id] = {};
for (const [peerId, levels] of Object.entries(byPeer)) {
const eff = levels.admin || levels.parent || levels.student;
if (eff) allOveralls[s.id][peerId] = eff;
}
for (const s of students) allOveralls[s.id] = {};
for (const o of constraintData.overalls) {
allOveralls[o.student_a_id][o.student_b_id] = o;
}
lastOveralls = allOveralls;