Skip to content

Commit

Permalink
properly include 0s
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonmyers committed Apr 5, 2024
1 parent dc3635e commit f3df3e0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions getRubric.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ async function getRubric (courseId, assignmentId, rubricId) {
])

const students = enrollments.filter(enrollment => enrollment.type === 'StudentEnrollment') // excludes StudentViewEnrollment but keeps StudentEnrollment, to keep studentView use enrollment.role
// const students = enrollments.filter(enrollment => enrollment.role === 'StudentEnrollment') use for testing
const nonStudents = enrollments.filter(enrollment => enrollment.role !== 'StudentEnrollment') // excludes both StudentViewEnrollment and StudentEnrollment

return students.map(student => {
Expand All @@ -32,7 +33,7 @@ async function getRubric (courseId, assignmentId, rubricId) {
const graderName = (grader.user && grader.user.name) || ''
const graderRole = grader.role || ''

const submissionScore = submission.score || ''
const submissionScore = submission.score !== null ? submission.score : '';
const overallComments = submission.submission_comments
? submission.submission_comments
.filter(comment => comment.author.id !== userCanvasID)
Expand All @@ -41,16 +42,14 @@ async function getRubric (courseId, assignmentId, rubricId) {

const rubricAssessments = rubrics.assessments.find(rubric => rubric.artifact_id === submissionId) || {}

const rubricScore = rubricAssessments.score || ''
const rubricScore = rubricAssessments.score !== null ? rubricAssessments.score : '';

const rubricData = (rubricAssessments.data || []).map(({ points, comments }) => ({ points, comments }))


const rubricGrader = nonStudents.find(nonStudent => nonStudent.user_id === rubricAssessments.assessor_id) || {}
const rubricGraderName = (rubricGrader.user && rubricGrader.user.name) || ''
const rubricGraderRole = rubricGrader.role || ''


return {
userName,
userSISID,
Expand Down

0 comments on commit f3df3e0

Please sign in to comment.