Class: Qti::V2::Models::AssessmentItem
- Inherits:
-
Base
show all
- Defined in:
- lib/qti/v2/models/assessment_item.rb
Defined Under Namespace
Classes: ScoringData
Constant Summary
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 inherited from Base
#qti_version
#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
Instance Method Details
#feedback ⇒ Object
48
49
50
|
# File 'lib/qti/v2/models/assessment_item.rb', line 48
def feedback
@feedback ||= interaction_model.canvas_item_feedback
end
|
#identifier ⇒ Object
19
20
21
|
# File 'lib/qti/v2/models/assessment_item.rb', line 19
def identifier
@identifier ||= xpath_with_single_check('//xmlns:assessmentItem/@identifier').content
end
|
#interaction_model ⇒ Object
#item_body ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/qti/v2/models/assessment_item.rb', line 7
def item_body
@item_body ||= begin
node = item_body_node.dup
prompt = node.at_xpath('//xmlns:prompt')
filter_item_body(node)
node.add_child(prompt&.dup) if prompt&.parent && prompt.parent != node
sanitize_content!(node.to_html)
end
end
|
#parent_stimulus_item_ident ⇒ Object
34
35
36
|
# File 'lib/qti/v2/models/assessment_item.rb', line 34
def parent_stimulus_item_ident
nil
end
|
#points_possible ⇒ Object
27
28
29
30
31
32
|
# File 'lib/qti/v2/models/assessment_item.rb', line 27
def points_possible
@points_possible ||= begin
xpath_with_single_check("//xmlns:outcomeDeclaration[@identifier='SCORE']/@normalMaximum")&.content ||
xpath_with_single_check("//xmlns:outcomeDeclaration[@identifier='MAXSCORE']//xmlns:value")&.content
end
end
|
#scoring_data_structs ⇒ Object
44
45
46
|
# File 'lib/qti/v2/models/assessment_item.rb', line 44
def scoring_data_structs
@scoring_data_structs ||= interaction_model.scoring_data_structs
end
|
#title ⇒ Object
23
24
25
|
# File 'lib/qti/v2/models/assessment_item.rb', line 23
def title
@title ||= xpath_with_single_check('//xmlns:assessmentItem/@title').content
end
|