Class: CanvasQtiToLearnosityConverter::MultipleAnswersQuestion
- Inherits:
-
MultipleChoiceQuestion
- Object
- QuizQuestion
- MultipleChoiceQuestion
- CanvasQtiToLearnosityConverter::MultipleAnswersQuestion
- Defined in:
- lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb
Instance Method Summary collapse
Methods inherited from MultipleChoiceQuestion
#add_learnosity_assets, #extract_options, #extract_response_id
Methods inherited from QuizQuestion
#convert, #dynamic_content_data, #extract_feedback, #extract_mattext, #extract_points_possible, #extract_stimulus, for, #initialize, #make_identifier, #process_assets!
Constructor Details
This class inherits a constructor from CanvasQtiToLearnosityConverter::QuizQuestion
Instance Method Details
#extract_validation ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb', line 126 def extract_validation() correct_condition = @xml.css('item > resprocessing > respcondition[continue="No"] > conditionvar > and > varequal') alt_responses = correct_condition.map(&:text) { "scoring_type" => "partialMatchV2", "rounding" => "none", "penalty" => extract_points_possible, "valid_response" => { "score" => extract_points_possible, "value" => alt_responses, }, } end |
#to_learnosity ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb', line 113 def to_learnosity shuffle = @xml.css("item > presentation > response_lid > render_choice").first&.attribute("shuffle")&.value { stimulus: extract_stimulus(), options: (), multiple_responses: true, shuffle_options: shuffle == "Yes", response_id: extract_response_id(), type: "mcq", validation: extract_validation() } end |