Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs EVAL-3842 flag=platform_service_speedgrader Test Plan: 1. Enable Platform SpeedGrader 2. Create a group assignment (grading students as as group). 3. Go to SpeedGrader and verify the dropdown contains group names. 4. Change the student_id query param to be the ID of a student that is part of a group but is not the group represenative. Then navigate to SpeedGrader. Notice the student_id query param is changed to the group rep's ID. 5. Change the assignment to grade group students individually. 6. Go to SpeedGrader and verify the dropdown contains student names. 7. Verify the comments section includes the option to send the comment to the individual or the group. Try sending a comment to the individual and to the group and verify it works. Change-Id: I3cbc9e57877b2b62ca3a018191483f3b75662451 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/344689 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Drake Harper <drake.harper@instructure.com> QA-Review: Drake Harper <drake.harper@instructure.com> Product-Review: Cameron Ray <cameron.ray@instructure.com>
- Loading branch information
1 parent
b2ff0fe
commit 7144a54
Showing
22 changed files
with
481 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Copyright (C) 2024 - present Instructure, Inc. | ||
# | ||
# This file is part of Canvas. | ||
# | ||
# Canvas is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU Affero General Public License as published by the Free | ||
# Software Foundation, version 3 of the License. | ||
# | ||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
class Loaders::SubmissionGroupIdLoader < GraphQL::Batch::Loader | ||
def perform(submissions) | ||
mapping = Group.ids_by_student_by_assignment(*student_and_assignment_ids(submissions)) | ||
submissions.each { |sub| fulfill(sub, mapping.dig(sub.assignment_id, sub.user_id)) } | ||
end | ||
|
||
private | ||
|
||
def student_and_assignment_ids(submissions) | ||
submissions.each_with_object([Set.new, Set.new]) do |sub, (student_ids, assignment_ids)| | ||
student_ids << sub.user_id | ||
assignment_ids << sub.assignment_id | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Copyright (C) 2024 - present Instructure, Inc. | ||
# | ||
# This file is part of Canvas. | ||
# | ||
# Canvas is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU Affero General Public License as published by the Free | ||
# Software Foundation, version 3 of the License. | ||
# | ||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
describe Loaders::SubmissionGroupIdLoader do | ||
before do | ||
account = Account.create! | ||
course = account.courses.create! | ||
@first_student = course.enroll_student(User.create!, enrollment_state: "active").user | ||
@second_student = course.enroll_student(User.create!, enrollment_state: "active").user | ||
@third_student = course.enroll_student(User.create!, enrollment_state: "active").user | ||
group_category = course.group_categories.create!(name: "My Category") | ||
@group_a = course.groups.create!(name: "Group A", group_category:) | ||
@group_b = course.groups.create!(name: "Group B", group_category:) | ||
@group_a.add_user(@first_student) | ||
@group_a.save! | ||
@group_b.add_user(@second_student) | ||
@group_b.save! | ||
@assignment = course.assignments.create!(title: "Example Assignment", group_category:) | ||
end | ||
|
||
let(:group_a_submission) { @assignment.submissions.find_by(user: @first_student) } | ||
let(:group_b_submission) { @assignment.submissions.find_by(user: @second_student) } | ||
let(:ungrouped_submission) { @assignment.submissions.find_by(user: @third_student) } | ||
let(:loader) { Loaders::SubmissionGroupIdLoader } | ||
|
||
it "returns the group id associated with the user, before the group has submitted" do | ||
GraphQL::Batch.batch do | ||
loader.load(group_a_submission).then do |group_id| | ||
expect(group_id).to eq @group_a.id | ||
end | ||
|
||
loader.load(group_b_submission).then do |group_id| | ||
expect(group_id).to eq @group_b.id | ||
end | ||
end | ||
end | ||
|
||
it "returns the group id associated with the user, after the group has submitted" do | ||
@assignment.submit_homework(@first_student, body: "help my legs are stuck under my desk!") | ||
@assignment.submit_homework(@second_student, body: "hello world!") | ||
|
||
GraphQL::Batch.batch do | ||
loader.load(group_a_submission).then do |group_id| | ||
expect(group_id).to eq @group_a.id | ||
end | ||
|
||
loader.load(group_b_submission).then do |group_id| | ||
expect(group_id).to eq @group_b.id | ||
end | ||
end | ||
end | ||
|
||
it "returns nil for users not in groups" do | ||
GraphQL::Batch.batch do | ||
loader.load(ungrouped_submission).then do |group_id| | ||
expect(group_id).to be_nil | ||
end | ||
end | ||
end | ||
|
||
it "returns nil for non-group assignments" do | ||
@assignment.update!(group_category: nil) | ||
GraphQL::Batch.batch do | ||
loader.load(group_a_submission).then do |group_id| | ||
expect(group_id).to be_nil | ||
end | ||
|
||
loader.load(group_b_submission).then do |group_id| | ||
expect(group_id).to be_nil | ||
end | ||
|
||
loader.load(ungrouped_submission).then do |group_id| | ||
expect(group_id).to be_nil | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.