Set bonus points for survey via LTI parameter
This commit is contained in:

committed by
Sebastian Serth

parent
b91a2b7ce0
commit
f7e3979e79
@ -76,14 +76,16 @@ class SessionsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def redirect_to_survey
|
def redirect_to_survey
|
||||||
# The following code is taken from store_lti_session_data(params) & send_score_for(submission, user)
|
if params[:custom_bonus_points]
|
||||||
# It gives a bonus point to users who opened the survey
|
# The following code is taken from store_lti_session_data(params) & send_score_for(submission, user)
|
||||||
begin
|
# It gives a bonus point to users who opened the survey
|
||||||
lti_parameters = params.slice(*Lti::SESSION_PARAMETERS).permit!.to_h
|
begin
|
||||||
provider = build_tool_provider(consumer: current_user.consumer, parameters: lti_parameters)
|
lti_parameters = params.slice(*Lti::SESSION_PARAMETERS).permit!.to_h
|
||||||
provider.post_replace_result!(1.0)
|
provider = build_tool_provider(consumer: current_user.consumer, parameters: lti_parameters)
|
||||||
rescue IMS::LTI::XMLParseError, Net::OpenTimeout, Net::ReadTimeout, Errno::ECONNRESET, SocketError, EOFError
|
provider.post_replace_result!(1.0)
|
||||||
# We don't do anything here because it is only a bonus point and we want the users to do the survey
|
rescue IMS::LTI::XMLParseError, Net::OpenTimeout, Net::ReadTimeout, Errno::ECONNRESET, SocketError, EOFError
|
||||||
|
# We don't do anything here because it is only a bonus point and we want the users to do the survey
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# This method is taken from Xikolo and slightly adapted.
|
# This method is taken from Xikolo and slightly adapted.
|
||||||
|
@ -9,7 +9,7 @@ class Event < ApplicationRecord
|
|||||||
|
|
||||||
validates :category, presence: true
|
validates :category, presence: true
|
||||||
|
|
||||||
# We temporary allow an event to be stored without data.
|
# We allow an event to be stored without data for pair programming (pp).
|
||||||
# This is useful if the category (together with the user and exercise) is already enough.
|
# This is useful if the category (together with the user and exercise) is already enough.
|
||||||
validates :data, presence: true, if: -> { %w[pp_start_chat pp_invalid_partners pp_work_alone].exclude?(category) }
|
validates :data, presence: true, if: -> { %w[pp_start_chat pp_invalid_partners pp_work_alone].exclude?(category) }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user