don't count deleted enrollments in grade calculations
fixes CNVS-16876 Test plan: * make a course with 3 enrollments * delete one of the enrollments * grade the other 2 enrollments on an assignment * the assignment stats in 'assignment details' in gb2 should be correct * the assignment stats on the students grade page should match Change-Id: Id750f2ff767d83318542bdfca5f2994867b95c8a Reviewed-on: https://gerrit.instructure.com/45098 Reviewed-by: Mike Nomitch <mnomitch@instructure.com> Reviewed-by: Josh Simpson <jsimpson@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Amber Taniuchi <amber@instructure.com> Product-Review: Cameron Matheson <cameron@instructure.com>
This commit is contained in:
parent
eebc16c620
commit
b4e45eb8f8
|
@ -459,7 +459,7 @@ class EnrollmentsApiController < ApplicationController
|
|||
if authorized_action(@context, @current_user, [:read_roster, :view_all_grades, :manage_grades])
|
||||
scope = @context.enrollments_visible_to(@current_user, :type => :all, :include_priors => true).where(enrollment_index_conditions)
|
||||
unless params[:state].present?
|
||||
scope = scope.where("enrollments.workflow_state NOT IN ('rejected', 'completed', 'deleted', 'inactive')")
|
||||
scope = scope.active_or_pending
|
||||
end
|
||||
scope
|
||||
else
|
||||
|
|
|
@ -183,7 +183,7 @@ class GradeSummaryPresenter
|
|||
end
|
||||
|
||||
def real_and_active_student_ids
|
||||
@context.all_real_student_enrollments.where("workflow_state not in (?)", ['rejected','inactive']).pluck(:user_id).uniq
|
||||
@context.all_real_student_enrollments.active_or_pending.pluck(:user_id).uniq
|
||||
end
|
||||
|
||||
def assignment_presenters
|
||||
|
|
|
@ -65,11 +65,16 @@ describe GradeSummaryPresenter do
|
|||
@course.disable_feature!(:differentiated_assignments)
|
||||
end
|
||||
it 'works' do
|
||||
s1, s2, s3 = n_students_in_course(3)
|
||||
s1, s2, s3, s4 = n_students_in_course(4)
|
||||
a = @course.assignments.create! points_possible: 10
|
||||
a.grade_student s1, grade: 0
|
||||
a.grade_student s2, grade: 5
|
||||
a.grade_student s3, grade: 10
|
||||
|
||||
# this student should be ignored
|
||||
a.grade_student s4, grade: 99
|
||||
s4.enrollments.each &:destroy
|
||||
|
||||
p = GradeSummaryPresenter.new(@course, @teacher, nil)
|
||||
stats = p.assignment_stats
|
||||
assignment_stats = stats[a.id]
|
||||
|
|
Loading…
Reference in New Issue