Class: Qti::V2::Models::NonAssessmentTest

Inherits:
AssessmentTest show all
Includes:
Models::ResourceGroup
Defined in:
lib/qti/v2/models/non_assessment_test.rb

Constant Summary

Constants included from Models::ResourceGroup

Models::ResourceGroup::ASSESSMENT_CLASSES, Models::ResourceGroup::EMBEDDED_NON_ASSESSMENT_ID, Models::ResourceGroup::EMBEDDED_QTI_TYPES, Models::ResourceGroup::RESOURCE_QTI_TYPES

Constants inherited from Base

Base::BODY_ELEMENTS_CSS, Base::CHOICE_ELEMENTS_CSS, Base::INTERACTION_ELEMENTS_CSS

Instance Attribute Summary

Attributes inherited from Models::Base

#doc, #manifest, #package_root, #path, #resource

Instance Method Summary collapse

Methods included from Models::ResourceGroup

#assessment_identifiers, #asset_resource_for, #asset_resource_for_canvas, #asset_resource_for_ims, #identifier_list, #item_resources_v2, #question_bank_identifiers, #resource_for, #resource_node, #resources

Methods inherited from AssessmentTest

#assessment_sections, #create_assessment_item, #create_stimulus, #test_parts, #title

Methods included from XPathHelpers

#rtype_predicate, #xpath_endswith, #xpath_resource

Methods included from Models::AssessmentMetaBase

#canvas_meta_data

Methods inherited from Base

#qti_version

Methods inherited from Models::Base

#css_with_single_check, from_path!, #initialize, #parse_html, #parse_xml, #preprocess_xml_doc, #raise_unsupported, #remap_href_path, #sanitize_content!, #xpath_with_single_check

Constructor Details

This class inherits a constructor from Qti::Models::Base

Instance Method Details

#assessment_itemsObject



9
10
11
12
13
14
15
16
17
# File 'lib/qti/v2/models/non_assessment_test.rb', line 9

def assessment_items
  # Return the xml files we should be parsing
  @assessment_item_resources ||= begin
    item_resources_v2.map do |node|
      rsc = Qti::Models::Resource.new(node, self)
      { path: remap_href_path(rsc.href), resource: rsc }
    end
  end
end

#stimulus_ref(assessment_item_ref) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/qti/v2/models/non_assessment_test.rb', line 19

def stimulus_ref(assessment_item_ref)
  ref = assessment_item_ref[:path].sub(@package_root, '')
  dependencies = @doc.xpath("//xmlns:resource[@href='#{ref}']/xmlns:dependency/@identifierref")
  return unless dependencies&.count == 1
  href = xpath_with_single_check("//xmlns:resource[@identifier='#{dependencies.first}']/@href")
  remap_href_path(href)
end