Skip to content

Commit

Permalink
Fix 'view by school' distribution graph
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyel committed Oct 10, 2024
1 parent 5d08489 commit 758473e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/ScoreReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,17 @@ const computeAssignmentAndRunData = computed(() => {
const runsByTaskIdAcc = {};

for (const { assignment, user } of assignmentData.value) {
// We can't garentee that the user's school is still in the current list of schools
// So we'll find the school both in the 'all' list as well as assignment.readOrgs
const userSchools = user.schools?.all;
const assignmentOrgs = assignment.readOrgs.schools;
const matchingSchools = userSchools?.filter((schoolId) => assignmentOrgs.includes(schoolId));

// 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
let schoolName = '';
const schoolId = user?.schools?.current[0];
const schoolId = matchingSchools[0];
if (schoolId) {
schoolName = schoolNameDictionary.value[schoolId];
}
Expand Down Expand Up @@ -765,7 +771,7 @@ const computeAssignmentAndRunData = computed(() => {
taskId,
user: {
grade: grade,
schoolName: schoolsDictWithGrade.value[schoolId],
schoolName: schoolsDictWithGrade.value[schoolId] ?? '0 Unknown School',
},
tag_color: tag_color,
};
Expand Down

0 comments on commit 758473e

Please sign in to comment.