fix empty rows in new gradebook for soft conclude

Soft concluded courses with hard concluded students were returning
ids for those hard concluded students while the frontend was only
expecting ids for non-hard concluded students. This was causing extra
rows to be present in the gradebook, which cascaded into grades not
showing up. This changes gradebook_user_ids to be in line with what
Gradebook.coffee is expecting.

fixes GRADE-1096

Test Plan
 - Create a course.
 - Turn on New Gradebook for the course.
 - Enroll at least two students.
 - Create an assignment.
 - Grade both students.
 - Conclude one student's enrollment.
 - Go to the course settings and change the course dates to start and
   end before the current day.
 - Under the course dates, check the box for
   "Users can only participate in the course between these dates"
 - Go back to the Gradebook.
 - Verify that there are no empty rows and only the students that are
   not concluded are present.
 - Set the grid to show concluded enrollments.
 - Verify that the concluded enrollments now appear.

Change-Id: I21ffa7ee52c07947710ff8ec68159fcfe96b0ec8
Reviewed-on: https://gerrit.instructure.com/154679
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Derek Bender <djbender@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
This commit is contained in:
Gary Mei 2018-06-21 09:30:25 -05:00
parent 39bdab8baa
commit d39a795518
2 changed files with 26 additions and 1 deletions

View File

@ -130,7 +130,7 @@ class GradebookUserIds
def student_enrollments_scope
workflow_states = [:active, :invited]
workflow_states << :inactive if @include_inactive
workflow_states << :completed if @include_concluded || @course.concluded?
workflow_states << :completed if @include_concluded || @course.completed?
student_enrollments = @course.enrollments.where(
workflow_state: workflow_states,
type: [:StudentEnrollment, :StudentViewEnrollment]

View File

@ -237,6 +237,11 @@ describe GradebookUserIds do
expect(gradebook_user_ids.user_ids).to include @concluded_student.id
end
it "does not include concluded student ids if the course is soft concluded" do
@course.conclude_at = 1.day.ago
expect(gradebook_user_ids.user_ids).not_to include @concluded_student.id
end
context 'with pg_collkey installed' do
before do
skip 'requires pg_collkey installed SD-2747' unless has_pg_collkey
@ -338,6 +343,11 @@ describe GradebookUserIds do
)
end
it "does not include concluded student ids if the course is soft concluded" do
@course.conclude_at = 1.day.ago
expect(gradebook_user_ids.user_ids).not_to include @concluded_student.id
end
context 'when pg_collkey is installed' do
before do
skip 'requires pg_collkey installed SD-2747' unless has_pg_collkey
@ -426,6 +436,11 @@ describe GradebookUserIds do
)
end
it "does not include concluded student ids if the course is soft concluded" do
@course.conclude_at = 1.day.ago
expect(gradebook_user_ids.user_ids).not_to include @concluded_student.id
end
context 'when pg_collkey is installed' do
before do
skip 'requires pg_collkey installed SD-2747' unless has_pg_collkey
@ -484,6 +499,11 @@ describe GradebookUserIds do
)
end
it "does not include concluded student ids if the course is soft concluded" do
@course.conclude_at = 1.day.ago
expect(gradebook_user_ids.user_ids).not_to include @concluded_student.id
end
context "ascending" do
before(:once) do
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_direction] = "ascending"
@ -801,6 +821,11 @@ describe GradebookUserIds do
expect(gradebook_user_ids.user_ids).to include @concluded_student.id
end
it "does not include concluded student ids if the course is soft concluded" do
@course.conclude_at = 1.day.ago
expect(gradebook_user_ids.user_ids).not_to include @concluded_student.id
end
context "Multiple Grading Periods" do
before(:once) do
term = @course.enrollment_term