Hide grades for OG anonymous muted assignments

In old Gradebook, hide grades for anonymous assignments when they are
muted.

closes GRADE-970

Test plan:
- Have a course in an account with Anonymous Moderated Marking on
- Create an assignment and enable anonymous grading for the assignment.
- Mute the assignment.
- Open old Gradebook.
- The assignment, when muted, should not show the values of grades at
  all (the cells should appear "grayed out")
- Check that the assignment can be unmuted/muted directly from the
  column header, and that the grade cells become editable when it is
  unmuted (and that, when muted once more, the grades revert to
  being unviewable)

Change-Id: Ia68600229b776475f69fbaeb6ae75e4b554d9063
Reviewed-on: https://gerrit.instructure.com/149515
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
This commit is contained in:
Adrian Packel 2018-05-07 17:07:01 -05:00
parent 8e783843ea
commit 90e2276db1
5 changed files with 90 additions and 13 deletions

View File

@ -319,6 +319,7 @@ define [
assignment.due_at = tz.parse(assignment.due_at)
if @options.anonymous_moderated_marking_enabled
assignment.moderation_in_progress = assignment.moderated_grading and !assignment.grades_published
assignment.hide_grades_when_muted = assignment.anonymous_grading
@updateAssignmentEffectiveDueDates(assignment)
@assignments[assignment.id] = assignment
@ -722,6 +723,8 @@ define [
if !assignment?
@staticCellFormatter(row, col, '')
else if assignment.hide_grades_when_muted and assignment.muted
@lockedAndHiddenGradeCellFormatter(row, col, 'anonymous')
else if submission.workflow_state == 'pending_review'
(SubmissionCell[assignment.grading_type] || SubmissionCell).formatter(row, col, submission, assignment, student, formatterOpts)
else if assignment.grading_type == 'points' && assignment.points_possible

View File

@ -20,6 +20,7 @@ define ['i18n!gradebook'], (I18n) ->
submission_tooltip_dropped: I18n.t('Dropped for grading purposes')
submission_tooltip_late: I18n.t('Submitted late')
submission_tooltip_anonymous: I18n.t('Anonymous')
submission_tooltip_moderated: I18n.t('Moderated Assignment')
submission_tooltip_muted: I18n.t('Assignment muted')
submission_tooltip_resubmitted: I18n.t('Resubmitted since last graded')
submission_tooltip_ungraded: I18n.t('Not factored into grading')

View File

@ -174,8 +174,10 @@ define [
classes.push('resubmitted') if submission.grade_matches_current_submission == false
classes.push('late') if submission.late
classes.push('ungraded') if ''+assignment.submission_types is "not_graded"
if assignment.moderation_in_progress
if assignment.anonymous_grading and (assignment.muted or assignment.moderation_in_progress)
classes.push('anonymous')
else if assignment.moderation_in_progress
classes.push('moderated')
else if assignment.muted
classes.push('muted')
classes.push(submission.submission_type) if submission.submission_type

View File

@ -875,6 +875,8 @@ QUnit.module('Gradebook#gotAllAssignmentGroups', suiteHooks => {
let unmoderatedAssignment
let moderatedUnpublishedAssignment
let moderatedPublishedAssignment
let anonymousUnmoderatedAssignment
let anonymousModeratedAssignment
let assignmentGroups
suiteHooks.beforeEach(() => {
@ -882,12 +884,14 @@ QUnit.module('Gradebook#gotAllAssignmentGroups', suiteHooks => {
id: 1,
name: 'test',
published: true,
anonymous_grading: false,
moderated_grading: false
}
moderatedUnpublishedAssignment = {
id: 2,
name: 'test',
published: true,
anonymous_grading: false,
moderated_grading: true,
grades_published: false
}
@ -895,13 +899,36 @@ QUnit.module('Gradebook#gotAllAssignmentGroups', suiteHooks => {
id: 3,
name: 'test',
published: true,
anonymous_grading: false,
moderated_grading: true,
grades_published: true
}
anonymousUnmoderatedAssignment = {
id: 4,
name: 'test',
published: true,
anonymous_grading: true,
moderated_grading: false,
grades_published: true
}
anonymousModeratedAssignment = {
id: 5,
name: 'test',
published: true,
anonymous_grading: true,
moderated_grading: true,
grades_published: true
}
assignmentGroups = [{
id: 1,
assignments: [unmoderatedAssignment, moderatedUnpublishedAssignment, moderatedPublishedAssignment]
assignments: [
unmoderatedAssignment,
moderatedUnpublishedAssignment,
moderatedPublishedAssignment,
anonymousUnmoderatedAssignment,
anonymousModeratedAssignment
]
}]
gradebook = createGradebook()
@ -934,10 +961,25 @@ QUnit.module('Gradebook#gotAllAssignmentGroups', suiteHooks => {
gradebook.gotAllAssignmentGroups(assignmentGroups)
strictEqual(unmoderatedAssignment.moderation_in_progress, false)
})
test('sets hide_grades_when_muted to true for an anonymous assignment', () => {
gradebook.gotAllAssignmentGroups(assignmentGroups)
strictEqual(anonymousUnmoderatedAssignment.hide_grades_when_muted, true)
})
test('sets hide_grades_when_muted to false for a non-anonymous assignment', () => {
gradebook.gotAllAssignmentGroups(assignmentGroups)
strictEqual(unmoderatedAssignment.hide_grades_when_muted, false)
})
})
test('does not set moderation_in_progress when anonymous moderated marking is off', () => {
gradebook.gotAllAssignmentGroups(assignmentGroups)
strictEqual(moderatedUnpublishedAssignment.moderation_in_progress, undefined)
})
test('does not set hide_grades_when_muted when anonymous moderated marking is off', () => {
gradebook.gotAllAssignmentGroups(assignmentGroups)
strictEqual(moderatedUnpublishedAssignment.hide_grades_when_muted, undefined)
})
})

View File

@ -549,31 +549,60 @@ test('#loadValue sets the value to grade when entered_grade is not available', f
})
QUnit.module('SubmissionCell#classesBasedOnSubmission', () => {
test('returns anonymous when moderation_in_progress is set on the assignment', () => {
const assignment = {moderation_in_progress: true}
test('returns anonymous when anonymous_grading and moderation_in_progress are set on the assignment', () => {
const assignment = {anonymous_grading: true, moderation_in_progress: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('anonymous'), true)
})
test('returns anonymous when anonymous_grading and muted are set on the assignment', () => {
const assignment = {anonymous_grading: true, muted: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('anonymous'), true)
})
test('does not return anonymous if anonymous_grading is not set on the assignment', () => {
strictEqual(SubmissionCell.classesBasedOnSubmission({}, {}).includes('anonymous'), false)
})
test('does not return anonymous if anonymous_grading is set but not moderation_in_progress or muted', () => {
const assignment = {anonymous_grading: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('anonymous'), false)
})
test('returns moderated when moderation_in_progress is set on the assignment', () => {
const assignment = {moderation_in_progress: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('moderated'), true)
})
test('returns moderated when muted and moderation_in_progress are set on the assignment', () => {
const assignment = {moderation_in_progress: true, muted: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('moderated'), true)
})
test('does not return moderated if moderation_in_progress is not set on the assignment', () => {
strictEqual(SubmissionCell.classesBasedOnSubmission({}, {}).includes('moderated'), false)
})
test('does not return moderated if moderation_in_progress and anonymous_grading are set on the assignment', () => {
const assignment = {moderation_in_progress: true, anonymous_grading: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('moderated'), false)
})
test('returns muted when muted is set on the assignment', () => {
const assignment = {muted: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('muted'), true)
})
test('returns anonymous when muted and moderation_in_progress are set on the assignment', () => {
const assignment = {moderation_in_progress: true, muted: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('anonymous'), true)
})
test('does not return muted when muted and moderation_in_progress are set on the assignment', () => {
const assignment = {moderation_in_progress: true, muted: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('muted'), false)
})
test('does not return muted when muted and anonymous_grading are set on the assignment', () => {
const assignment = {anonymous_grading: true, muted: true}
strictEqual(SubmissionCell.classesBasedOnSubmission({}, assignment).includes('muted'), false)
})
test('does not return muted if it is not set on the assignment', () => {
strictEqual(SubmissionCell.classesBasedOnSubmission({}, {}).includes('muted'), false)
})
test('does not return anonymous if moderation_in_progress is not set on the assignment', function() {
strictEqual(SubmissionCell.classesBasedOnSubmission({}, {}).includes('anonymous'), false)
})
})