rename params to match score to un ungraded api endpoint

closes EVAL-2235
closes EVAL-2254
closes EVAL-2256
flag=none

test plan past due date:
- enable the feature flag “Score to ungraded“.
- create and publish a course with one teacher
  and two students.
- create an assignment A1 with no due date.
- create an assignment A2 with a past due date.
- create an assignment A3 with a future due date.
- go to the gradebook page.
- click in the total dropdown menu and select the
  "Score to ungraded option".
- in the modal choose "Only ungraded artifacts
  that are past due".
- wait some seconds until the process finishes.
- refresh the page.
- notice that the only affected submissions are
  those who belongs to the A2 assignment.

test plan excused:
- create three assignments A1, A2, A3.
- go to the gradebook page.
- Give a score to one of the students.
- click in the total dropdown menu and select the
  "Score to ungraded option".
- in the modal put "EX" in the grade for ungraded
  submissions input.
- wait some seconds until the process finishes.
- refresh the page.
- notice the ungraded submissions are marked as
  excused, the previously graded submissions is
  untouched.

test plan student group:
- create an assignment and check the option "This is
  a Group Assignment", create a new group set with
  the students splitted in two groups.
- go to the gradebook page.
- enable the student groups filter using the View
  dropdown menu in gradebook.
- use the filter dropdown to select one of the
  student groups.
- click in the total dropdown menu and select the
  "Score to ungraded option".
- put some percentage for the grade input in the
  modal and click on "Apply score".
- wait some seconds until the process finishes.
- refresh the page.
- notice the only affected submissions are those
  that belongs to the selected student group.

Change-Id: I8d6197c28cceb512db442d0365aa8e39ff4402e5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284965
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
This commit is contained in:
Eduardo Escobar 2022-02-11 12:12:06 -05:00
parent e34ecb191e
commit d9dbe63967
4 changed files with 14 additions and 8 deletions

View File

@ -1175,12 +1175,12 @@ class GradebooksController < ApplicationController
percent: percent_value,
excused: excused,
mark_as_missing: Canvas::Plugin.value_to_boolean(params[:mark_as_missing]),
only_apply_to_past_due: Canvas::Plugin.value_to_boolean(params[:only_apply_to_past_due])
only_apply_to_past_due: Canvas::Plugin.value_to_boolean(params[:only_past_due])
)
options.assignment_group = @context.assignment_groups.active.find(params[:assignment_group_id]) if params[:assignment_group_id].present?
options.context_module = @context.context_modules.not_deleted.find(params[:module_id]) if params[:module_id].present?
options.course_section = @context.course_sections.active.find(params[:course_section_id]) if params[:course_section_id].present?
options.student_group = @context.active_groups.find(params[:group_id]) if params[:group_id].present?
options.student_group = @context.active_groups.find(params[:student_group_id]) if params[:student_group_id].present?
if params[:grading_period_id].present?
grading_period = GradingPeriod.for(@context).find(params[:grading_period_id])

View File

@ -3353,7 +3353,7 @@ describe GradebooksController do
end
it "accepts a valid student_group_id that is part of the course" do
make_request(percent: 50.0, group_id: student_group.id)
make_request(percent: 50.0, student_group_id: student_group.id)
expect(response).to be_successful
end
@ -3362,7 +3362,7 @@ describe GradebooksController do
other_category.create_groups(1)
other_group = other_category.groups.first
make_request(percent: 50.0, group_id: other_group.id)
make_request(percent: 50.0, student_group_id: other_group.id)
expect(response).to be_not_found
end
end

View File

@ -569,9 +569,9 @@ QUnit.module('Gradebook#executeApplyScoreToUngraded', hooks => {
strictEqual(startProcessStub.firstCall.args[1].percent, 50.0)
})
test('calls the startProcess method with the "excuse" parameter when given a value of "excused"', async () => {
test('calls the startProcess method with the "excused" parameter when given a value of "excused"', async () => {
await gradebook.executeApplyScoreToUngraded({value: 'excused'})
strictEqual(startProcessStub.firstCall.args[1].excuse, true)
strictEqual(startProcessStub.firstCall.args[1].excused, true)
})
test('passes any additional arguments to the endpoint', async () => {

View File

@ -4620,16 +4620,22 @@ class Gradebook extends React.Component<GradebookProps, GradebookState> {
// instead, either by replacing the lines below with checks against the
// current filters or by passing the ID of the active filter (and looking up
// the contents of the filter on the back-end)
let moduleId = this.getFilterColumnsBySetting('contextModuleId')
if (moduleId === '0') {
moduleId = null
}
const optionsWithFilters = {
...options,
courseSectionId: this.getFilterRowsBySetting('sectionId'),
gradingPeriodId: this.getFilterColumnsBySetting('gradingPeriodId'),
moduleId: this.getFilterColumnsBySetting('contextModuleId'),
moduleId,
studentGroupId: this.getFilterRowsBySetting('studentGroupId')
}
if (value === 'excused') {
optionsWithFilters.excuse = true
optionsWithFilters.excused = true
} else {
optionsWithFilters.percent = value
}