fix post grades placement for lti 2
test plan: * install a post grades lti 2 tool * the post grades placement should be shown for the tool * the tool should be shown on the gradebook page for posting grades fixes SKYW-106 Change-Id: I25f26c09017d8967799b3692a2aeb15986a4c322 Reviewed-on: https://gerrit.instructure.com/57576 Reviewed-by: Nathan Mills <nathanm@instructure.com> Tested-by: Jenkins QA-Review: Steven Shepherd <sshepherd@instructure.com> Product-Review: Mark Severson <markse@instructure.com>
This commit is contained in:
parent
0062871d45
commit
d8045897e4
|
@ -211,7 +211,7 @@ class GradebooksController < ApplicationController
|
|||
case launch_definition[:definition_type]
|
||||
when 'ContextExternalTool'
|
||||
url = external_tool_url_for_lti1(launch_definition)
|
||||
when 'MessageHandler'
|
||||
when 'Lti::MessageHandler'
|
||||
url = external_tool_url_for_lti2(launch_definition)
|
||||
end
|
||||
launch_definition[:placements][:post_grades][:canvas_launch_url] = url
|
||||
|
|
|
@ -19,19 +19,21 @@
|
|||
module Lti
|
||||
class ResourcePlacement < ActiveRecord::Base
|
||||
|
||||
RESOURCE_SELECTION = 'resource_selection'
|
||||
ASSIGNMENT_SELECTION = 'assignment_selection'
|
||||
LINK_SELECTION = 'link_selection'
|
||||
ACCOUNT_NAVIGATION = 'account_navigation'
|
||||
ASSIGNMENT_SELECTION = 'assignment_selection'
|
||||
COURSE_NAVIGATION = 'course_navigation'
|
||||
LINK_SELECTION = 'link_selection'
|
||||
POST_GRADES = 'post_grades'
|
||||
RESOURCE_SELECTION = 'resource_selection'
|
||||
|
||||
DEFAULT_PLACEMENTS = [ASSIGNMENT_SELECTION, LINK_SELECTION]
|
||||
DEFAULT_PLACEMENTS = [ASSIGNMENT_SELECTION, LINK_SELECTION].freeze
|
||||
|
||||
PLACEMENT_LOOKUP = {
|
||||
'Canvas.placements.accountNavigation' => ACCOUNT_NAVIGATION,
|
||||
'Canvas.placements.assignmentSelection' => ASSIGNMENT_SELECTION,
|
||||
'Canvas.placements.courseNavigation' => COURSE_NAVIGATION,
|
||||
'Canvas.placements.linkSelection' => LINK_SELECTION,
|
||||
'Canvas.placements.assignmentSelection' => ASSIGNMENT_SELECTION,
|
||||
'Canvas.placements.postGrades' => POST_GRADES,
|
||||
}.freeze
|
||||
|
||||
attr_accessible :placement, :message_handler, :resource_handler
|
||||
|
@ -43,4 +45,4 @@ module Lti
|
|||
validates_inclusion_of :placement, :in => PLACEMENT_LOOKUP.values
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,6 +14,7 @@ module Lti
|
|||
Canvas.placements.courseNavigation
|
||||
Canvas.placements.assignmentSelection
|
||||
Canvas.placements.linkSelection
|
||||
Canvas.placements.postGrades
|
||||
User.username
|
||||
Person.email.primary
|
||||
Person.name.given
|
||||
|
|
|
@ -90,7 +90,11 @@ module Lti
|
|||
|
||||
def self.lti2_placements(message_handler, placements)
|
||||
resource_placements = message_handler.placements.pluck(:placement)
|
||||
valid_placements = resource_placements.present? ? resource_placements & placements : ResourcePlacement::DEFAULT_PLACEMENTS
|
||||
if resource_placements.present?
|
||||
valid_placements = resource_placements & placements.map(&:to_s)
|
||||
else
|
||||
valid_placements = ResourcePlacement::DEFAULT_PLACEMENTS
|
||||
end
|
||||
valid_placements.each_with_object({}) { |p, hsh| hsh[p.to_sym] = lti2_placement(message_handler) }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue