Skip to content

Commit

Permalink
add anonymous_grading field to 'assignment_updated' live event
Browse files Browse the repository at this point in the history
closes EVAL-3392
flag=anonymous_marking

test plan:
- update an assignment to emit a live event
- ensure `anonymous_grading` field is present in the live event

Change-Id: I8cecb06064cbd0b9dcd142e85eb636edbe893161
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/324779
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cameron Ray <cameron.ray@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
Reviewed-by: Christopher Soto <christopher.soto@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
  • Loading branch information
dwilli77 committed Aug 15, 2023
1 parent e30409a commit 03fc042
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/canvas/live_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,28 +238,30 @@ def self.get_assignment_data(assignment)
assignment.migration_id&.start_with?(MasterCourses::MIGRATION_ID_PREFIX)

event = {
anonymous_grading: assignment.anonymous_grading,
assignment_group_id: assignment.global_assignment_group_id,
assignment_id: assignment.global_id,
assignment_id_duplicated_from: assignment.duplicate_of&.global_id&.to_s,
context_id: assignment.global_context_id,
context_uuid: assignment.context.uuid,
context_type: assignment.context_type,
assignment_group_id: assignment.global_assignment_group_id,
workflow_state: assignment.workflow_state,
title: LiveEvents.truncate(assignment.title),
context_uuid: assignment.context.uuid,
created_on_blueprint_sync: created_on_blueprint_sync || false,
description: LiveEvents.truncate(assignment.description),
due_at: assignment.due_at,
unlock_at: assignment.unlock_at,
lock_at: assignment.lock_at,
updated_at: assignment.updated_at,
points_possible: assignment.points_possible,
lti_assignment_id: assignment.lti_context_id,
lti_assignment_description: LiveEvents.truncate(assignment.description),
lti_assignment_id: assignment.lti_context_id,
lti_resource_link_id: assignment.lti_resource_link_id,
lti_resource_link_id_duplicated_from: assignment.duplicate_of&.lti_resource_link_id,
lock_at: assignment.lock_at,
points_possible: assignment.points_possible,
resource_map: assignment.resource_map,
submission_types: assignment.submission_types,
created_on_blueprint_sync: created_on_blueprint_sync || false,
resource_map: assignment.resource_map
title: LiveEvents.truncate(assignment.title),
unlock_at: assignment.unlock_at,
updated_at: assignment.updated_at,
workflow_state: assignment.workflow_state
}

actl = assignment.assignment_configuration_tool_lookups.take
domain = assignment.root_account&.environment_specific_domain
event[:domain] = domain if domain
Expand Down
1 change: 1 addition & 0 deletions spec/lib/canvas/live_events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ def wiki_page_updated
it "triggers a live event with assignment details" do
expect_event("assignment_updated",
hash_including({
anonymous_grading: @assignment.anonymous_grading,
assignment_id: @assignment.global_id.to_s,
context_id: @course.global_id.to_s,
context_uuid: @course.uuid,
Expand Down

0 comments on commit 03fc042

Please sign in to comment.