new gradebook: include concluded user_ids for concluded courses
closes CNVS-37758 test plan: - Create a course that has some active students, grade the students, and conclude the course. Enable New Gradebook and go to the gradebook. - hit the user_ids endpoint and confirm that the once active students still show up now that they are concluded Change-Id: Id9c3ddacf07b3a8b6b7c9d0a04f005d006747aa5 Reviewed-on: https://gerrit.instructure.com/116726 Reviewed-by: Spencer Olson <solson@instructure.com> Reviewed-by: Derek Bender <djbender@instructure.com> Tested-by: Jenkins QA-Review: Spencer Olson <solson@instructure.com> Product-Review: Keith T. Garner <kgarner@instructure.com>
This commit is contained in:
parent
7041fd25ca
commit
8c41c78d63
|
@ -96,7 +96,7 @@ class GradebookUserIds
|
|||
def student_enrollments_scope
|
||||
workflow_states = [:active, :invited]
|
||||
workflow_states << :inactive if @include_inactive
|
||||
workflow_states << :completed if @include_concluded
|
||||
workflow_states << :completed if @include_concluded || @course.concluded?
|
||||
student_enrollments = @course.enrollments.where(
|
||||
workflow_state: workflow_states,
|
||||
type: [:StudentEnrollment, :StudentViewEnrollment]
|
||||
|
|
|
@ -126,6 +126,13 @@ describe GradebookUserIds do
|
|||
@teacher.preferences[:gradebook_settings][@course.id][:show_concluded_enrollments] = "true"
|
||||
expect(gradebook_user_ids.user_ids).to include @concluded_student.id
|
||||
end
|
||||
|
||||
it "includes concluded students ids if the course is concluded" do
|
||||
@course.complete!
|
||||
expect(gradebook_user_ids.user_ids).to eq(
|
||||
[@student1.id, @student3.id, @concluded_student.id, @student2.id, @fake_student.id]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "assignment sorting" do
|
||||
|
@ -161,6 +168,13 @@ describe GradebookUserIds do
|
|||
@teacher.preferences[:gradebook_settings][@course.id][:show_concluded_enrollments] = "true"
|
||||
expect(gradebook_user_ids.user_ids).to include @concluded_student.id
|
||||
end
|
||||
|
||||
it "includes concluded students ids if the course is concluded" do
|
||||
@course.complete!
|
||||
expect(gradebook_user_ids.user_ids).to match_array(
|
||||
[@student1.id, @student2.id, @student3.id, @concluded_student.id, @fake_student.id]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "sort by late" do
|
||||
|
@ -191,6 +205,13 @@ describe GradebookUserIds do
|
|||
@teacher.preferences[:gradebook_settings][@course.id][:show_concluded_enrollments] = "true"
|
||||
expect(gradebook_user_ids.user_ids).to include @concluded_student.id
|
||||
end
|
||||
|
||||
it "includes concluded students ids if the course is concluded" do
|
||||
@course.complete!
|
||||
expect(gradebook_user_ids.user_ids).to match_array(
|
||||
[@student1.id, @student2.id, @student3.id, @concluded_student.id, @fake_student.id]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "sort by grade" do
|
||||
|
@ -198,12 +219,20 @@ describe GradebookUserIds do
|
|||
@assignment.grade_student(@student1, grade: 8, grader: @teacher)
|
||||
@assignment.grade_student(@student2, grade: 1, grader: @teacher)
|
||||
@assignment.grade_student(@student3, grade: 9, grader: @teacher)
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_column_id] = "assignment_#{@assignment.id}"
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_setting_key] = "grade"
|
||||
end
|
||||
|
||||
it "includes concluded students ids if the course is concluded" do
|
||||
@course.complete!
|
||||
expect(gradebook_user_ids.user_ids).to match_array(
|
||||
[@student1.id, @student2.id, @student3.id, @concluded_student.id, @fake_student.id]
|
||||
)
|
||||
end
|
||||
|
||||
context "ascending" do
|
||||
before(:once) do
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_column_id] = "assignment_#{@assignment.id}"
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_setting_key] = "grade"
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_direction] = "ascending"
|
||||
end
|
||||
|
||||
it "returns user ids sorted by grade on the assignment" do
|
||||
|
@ -239,8 +268,6 @@ describe GradebookUserIds do
|
|||
|
||||
context "descending" do
|
||||
before(:once) do
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_column_id] = "assignment_#{@assignment.id}"
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_setting_key] = "grade"
|
||||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_direction] = "descending"
|
||||
end
|
||||
|
||||
|
@ -308,6 +335,13 @@ describe GradebookUserIds do
|
|||
@teacher.preferences[:gradebook_settings][@course.id][:sort_rows_by_setting_key] = "grade"
|
||||
end
|
||||
|
||||
it "includes concluded students ids if the course is concluded" do
|
||||
@course.complete!
|
||||
expect(gradebook_user_ids.user_ids).to match_array(
|
||||
[@student1.id, @student2.id, @student3.id, @concluded_student.id, @fake_student.id]
|
||||
)
|
||||
end
|
||||
|
||||
it "sorts by total grade ascending" do
|
||||
expect(gradebook_user_ids.user_ids).to eq([@student1.id, @student2.id, @student3.id, @fake_student.id])
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue