fix outcomes cannot be added to rubrics

fix outcomes cannot be added to a rubric for an external tool
assignment

closes EVAL-3443
flag=none

test plan:
- have a course and teacher
- as the teacher, create a new external tools assignment
- press the add rubric button and click on the Find Outcome link
- see that it opens a modal with the outcomes

Change-Id: I7156dc8ad69dbe70aa16f45cfaeec82d5076900e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327132
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Derek Williams <derek.williams@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Ravi Koll <ravi.koll@instructure.com>
This commit is contained in:
Samuel Lee 2023-09-07 09:48:54 -05:00
parent 304c95eb61
commit 5fd4ea859f
2 changed files with 14 additions and 2 deletions

View File

@ -325,7 +325,10 @@ class AssignmentsController < ApplicationController
end
end
env = js_env({ COURSE_ID: @context.id })
env = js_env({
COURSE_ID: @context.id,
ROOT_OUTCOME_GROUP: outcome_group_json(@context.root_outcome_group, @current_user, session)
})
submission = @assignment.submissions.find_by(user: @current_user)
if submission
js_env({ SUBMISSION_ID: submission.id })
@ -423,7 +426,6 @@ class AssignmentsController < ApplicationController
EULA_URL: tool_eula_url,
EXTERNAL_TOOLS: external_tools_json(@external_tools, @context, @current_user, session),
PERMISSIONS: permissions,
ROOT_OUTCOME_GROUP: outcome_group_json(@context.root_outcome_group, @current_user, session),
SIMILARITY_PLEDGE: @similarity_pledge,
CONFETTI_ENABLED: @domain_root_account&.feature_enabled?(:confetti_for_assignments),
EMOJIS_ENABLED: @context.feature_enabled?(:submission_comment_emojis),

View File

@ -1244,6 +1244,16 @@ describe AssignmentsController do
assert_require_login
end
it "sets 'ROOT_OUTCOME_GROUP' for external tool assignments in the teacher view" do
user_session(@teacher)
@assignment.submission_types = "external_tool"
@assignment.build_external_tool_tag(url: "http://example.com/test")
@assignment.save!
get "show", params: { course_id: @course.id, id: @assignment.id }
expect(assigns[:js_env][:ROOT_OUTCOME_GROUP]).not_to be_nil
end
it "sets first_annotation_submission to true if it's the first submission and the assignment is annotatable" do
user_session(@student)
attachment = attachment_model(content_type: "application/pdf", display_name: "file.pdf", user: @teacher)