class Qti::V1::Models::Interactions::OrderingInteraction

Public Class Methods

matches(node, parent) click to toggle source

This will know if a class matches

# File lib/qti/v1/models/interactions/ordering_interaction.rb, line 7
def self.matches(node, parent)
  matches = node.xpath('.//xmlns:response_lid')
  return false if matches.count > 1 || matches.empty?
  rcardinality = matches.first.attributes['rcardinality']&.value || 'Single'
  return false if rcardinality != 'Ordered'
  new(node, parent)
end

Public Instance Methods

scoring_data_structs() click to toggle source
# File lib/qti/v1/models/interactions/ordering_interaction.rb, line 15
def scoring_data_structs
  correct_order = node.xpath('.//xmlns:varequal').map(&:content)
  correct_order.map { |id| ScoringData.new(id, rcardinality) }
end