diff --git a/src/pages/ScoreReport.vue b/src/pages/ScoreReport.vue index 090eff808..73df25643 100644 --- a/src/pages/ScoreReport.vue +++ b/src/pages/ScoreReport.vue @@ -597,9 +597,12 @@ const computeAssignmentAndRunData = computed(() => { for (const { assignment, user } of assignmentData.value) { // for each row, compute: username, firstName, lastName, assessmentPID, grade, school, all the scores, and routeParams for report link const grade = user.studentData?.grade; - // compute schoolName + + // compute schoolName. Use the schoolId from the assignment's assigningOrgs, as this should be correct even when the + // user is unenrolled. The assigningOrgs should be up to date and persistant. Fallback to the student's current schools. let schoolName = ''; - const schoolId = user?.schools?.current[0]; + const assigningSchool = assignment?.assigningOrgs?.schools; + const schoolId = assigningSchool[0] ?? user?.schools?.current[0]; if (schoolId) { schoolName = schoolNameDictionary.value[schoolId]; } @@ -783,7 +786,7 @@ const computeAssignmentAndRunData = computed(() => { taskId, user: { grade: grade, - schoolName: schoolsDictWithGrade.value[schoolId], + schoolName: schoolsDictWithGrade.value[schoolId] ?? '0 Unknown School', }, tag_color: tag_color, };