qti 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37dccfba39c7ff45b6b624f53e83781b4f930dd7
4
- data.tar.gz: 32b1734d6c6860d26d782b43b8aad9768fb09b47
3
+ metadata.gz: 1897287f2eb2b6af316a0f7c81112e50fe2e8d43
4
+ data.tar.gz: 41cc16c9d6928833b10c963a17f181eb9d5f2361
5
5
  SHA512:
6
- metadata.gz: 6b2581f1059182c8455d41a4e822a7ebaa1311e474e7b0e6c15b5dd17e44efb7630e01dd56a84d9cee722a33fbe0096362860f96635af413ebd206e7d2a50c97
7
- data.tar.gz: 4a67575c0709af214c3a6228fdbb0ec6cff7cb74d137d79b1b71b6af536995210b983d97b57b8c20988468cf9d835c249ec00ba2134399530a8e47600fd80cac
6
+ metadata.gz: f3a3945bbe3401cb3cfc512bbcefc301a3cd4983e9b2d6da4a9b9ac4e851bce71fa76e5c0be1c45f416eed89c196802e62794c9af5923f8194a5d28a6c3f9f2a
7
+ data.tar.gz: dca959a4115b19ab11172438045b8f973511b92b1fa7c19767887f004ff655bbba00b03b7ba4f22796bc123dd3aa5b45a8e2aa4133c0cb60698ba15ca9448e17
@@ -29,7 +29,7 @@ module Qti
29
29
  answer_choices.children.filter('not').each(&:remove)
30
30
  answer_choices.children.map { |value_node| ScoringData.new(value_node.content, rcardinality) }
31
31
  else
32
- set_var_nodes = choice_nodes.select { |choice_node| choice_node.at_xpath('.//xmlns:setvar').content.to_f.positive? }
32
+ set_var_nodes = choice_nodes.select { |choice_node| choice_node.at_xpath('.//xmlns:setvar')&.content&.to_f&.positive? }
33
33
  set_var_nodes.map { |value_node| ScoringData.new(value_node.at_xpath('.//xmlns:varequal').content, rcardinality) }
34
34
  end
35
35
  end
@@ -54,7 +54,7 @@ module Qti
54
54
  rcardinality,
55
55
  {
56
56
  id: value_node.attributes['respident']&.value,
57
- case: value_node.attributes['case']&.value
57
+ case: value_node.attributes['case']&.value || 'no'
58
58
  }
59
59
  )
60
60
  }
@@ -0,0 +1,57 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <quiz identifier="i6c88aaf29feba2ffa58a487a20665394" xmlns="http://canvas.instructure.com/xsd/cccv1p0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://canvas.instructure.com/xsd/cccv1p0 http://canvas.instructure.com/xsd/cccv1p0.xsd">
3
+ <title>Canvas Quiz with 1 Comment</title>
4
+ <description>&lt;p&gt;Canvas Quiz with 1 Comment&lt;/p&gt;</description>
5
+ <shuffle_answers>false</shuffle_answers>
6
+ <scoring_policy>keep_highest</scoring_policy>
7
+ <quiz_type>assignment</quiz_type>
8
+ <points_possible>4.0</points_possible>
9
+ <require_lockdown_browser>false</require_lockdown_browser>
10
+ <require_lockdown_browser_for_results>false</require_lockdown_browser_for_results>
11
+ <require_lockdown_browser_monitor>false</require_lockdown_browser_monitor>
12
+ <lockdown_browser_monitor_data/>
13
+ <show_correct_answers>true</show_correct_answers>
14
+ <anonymous_submissions>false</anonymous_submissions>
15
+ <could_be_locked>false</could_be_locked>
16
+ <allowed_attempts>1</allowed_attempts>
17
+ <one_question_at_a_time>false</one_question_at_a_time>
18
+ <cant_go_back>false</cant_go_back>
19
+ <available>true</available>
20
+ <one_time_results>false</one_time_results>
21
+ <show_correct_answers_last_attempt>false</show_correct_answers_last_attempt>
22
+ <only_visible_to_overrides>false</only_visible_to_overrides>
23
+ <module_locked>false</module_locked>
24
+ <assignment identifier="i586a23c8b847a4d66d640c9a6bff1a20">
25
+ <title>Canvas Quiz with 1 Comment</title>
26
+ <due_at/>
27
+ <lock_at/>
28
+ <unlock_at/>
29
+ <module_locked>false</module_locked>
30
+ <workflow_state>published</workflow_state>
31
+ <assignment_overrides>
32
+ </assignment_overrides>
33
+ <quiz_identifierref>i6c88aaf29feba2ffa58a487a20665394</quiz_identifierref>
34
+ <has_group_category>false</has_group_category>
35
+ <points_possible>4.0</points_possible>
36
+ <grading_type>points</grading_type>
37
+ <all_day>false</all_day>
38
+ <submission_types>online_quiz</submission_types>
39
+ <position>6</position>
40
+ <turnitin_enabled>false</turnitin_enabled>
41
+ <vericite_enabled>false</vericite_enabled>
42
+ <peer_review_count>0</peer_review_count>
43
+ <peer_reviews>false</peer_reviews>
44
+ <automatic_peer_reviews>false</automatic_peer_reviews>
45
+ <moderated_grading>false</moderated_grading>
46
+ <anonymous_peer_reviews>false</anonymous_peer_reviews>
47
+ <grade_group_students_individually>false</grade_group_students_individually>
48
+ <freeze_on_copy>false</freeze_on_copy>
49
+ <muted>false</muted>
50
+ <omit_from_final_grade>false</omit_from_final_grade>
51
+ <intra_group_peer_reviews>false</intra_group_peer_reviews>
52
+ <only_visible_to_overrides>false</only_visible_to_overrides>
53
+ </assignment>
54
+ <assignment_group_identifierref>i3e19faa4291bd43ebb8783c9f176b0ae</assignment_group_identifierref>
55
+ <assignment_overrides>
56
+ </assignment_overrides>
57
+ </quiz>
@@ -0,0 +1,110 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
3
+ <assessment ident="i6c88aaf29feba2ffa58a487a20665394" title="Canvas Quiz with 1 Comment">
4
+ <qtimetadata>
5
+ <qtimetadatafield>
6
+ <fieldlabel>cc_maxattempts</fieldlabel>
7
+ <fieldentry>1</fieldentry>
8
+ </qtimetadatafield>
9
+ </qtimetadata>
10
+ <section ident="root_section">
11
+ <item ident="iab6bb0c682429210e52f46c57fe4ffd0" title="Question">
12
+ <itemmetadata>
13
+ <qtimetadata>
14
+ <qtimetadatafield>
15
+ <fieldlabel>question_type</fieldlabel>
16
+ <fieldentry>multiple_choice_question</fieldentry>
17
+ </qtimetadatafield>
18
+ <qtimetadatafield>
19
+ <fieldlabel>points_possible</fieldlabel>
20
+ <fieldentry>1.0</fieldentry>
21
+ </qtimetadatafield>
22
+ <qtimetadatafield>
23
+ <fieldlabel>assessment_question_identifierref</fieldlabel>
24
+ <fieldentry>ia8e74b02eb98eca257ee09872f91abcd</fieldentry>
25
+ </qtimetadatafield>
26
+ </qtimetadata>
27
+ </itemmetadata>
28
+ <presentation>
29
+ <material>
30
+ <mattext texttype="text/html">&lt;div&gt;&lt;p&gt;Multiple Choice With Comments&lt;/p&gt;&lt;/div&gt;</mattext>
31
+ </material>
32
+ <response_lid ident="response1" rcardinality="Single">
33
+ <render_choice>
34
+ <response_label ident="2310">
35
+ <material>
36
+ <mattext texttype="text/plain">Correct</mattext>
37
+ </material>
38
+ </response_label>
39
+ <response_label ident="3455">
40
+ <material>
41
+ <mattext texttype="text/plain">Wrong</mattext>
42
+ </material>
43
+ </response_label>
44
+ <response_label ident="5376">
45
+ <material>
46
+ <mattext texttype="text/plain">Super Wrong</mattext>
47
+ </material>
48
+ </response_label>
49
+ <response_label ident="1830">
50
+ <material>
51
+ <mattext texttype="text/plain"></mattext>
52
+ </material>
53
+ </response_label>
54
+ <response_label ident="5977">
55
+ <material>
56
+ <mattext texttype="text/plain"></mattext>
57
+ </material>
58
+ </response_label>
59
+ </render_choice>
60
+ </response_lid>
61
+ </presentation>
62
+ <resprocessing>
63
+ <outcomes>
64
+ <decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
65
+ </outcomes>
66
+ <respcondition continue="Yes">
67
+ <conditionvar>
68
+ <other/>
69
+ </conditionvar>
70
+ <displayfeedback feedbacktype="Response" linkrefid="general_fb"/>
71
+ </respcondition>
72
+ <respcondition continue="No">
73
+ <conditionvar>
74
+ <varequal respident="response1">2310</varequal>
75
+ </conditionvar>
76
+ <setvar action="Set" varname="SCORE">100</setvar>
77
+ <displayfeedback feedbacktype="Response" linkrefid="correct_fb"/>
78
+ </respcondition>
79
+ <respcondition continue="Yes">
80
+ <conditionvar>
81
+ <other/>
82
+ </conditionvar>
83
+ <displayfeedback feedbacktype="Response" linkrefid="general_incorrect_fb"/>
84
+ </respcondition>
85
+ </resprocessing>
86
+ <itemfeedback ident="general_fb">
87
+ <flow_mat>
88
+ <material>
89
+ <mattext texttype="text/html">&lt;p&gt;General Answer Comments&lt;/p&gt;</mattext>
90
+ </material>
91
+ </flow_mat>
92
+ </itemfeedback>
93
+ <itemfeedback ident="correct_fb">
94
+ <flow_mat>
95
+ <material>
96
+ <mattext texttype="text/html">&lt;p&gt;GREAT!~&lt;/p&gt;</mattext>
97
+ </material>
98
+ </flow_mat>
99
+ </itemfeedback>
100
+ <itemfeedback ident="general_incorrect_fb">
101
+ <flow_mat>
102
+ <material>
103
+ <mattext texttype="text/html">&lt;p&gt;BAD!&lt;/p&gt;</mattext>
104
+ </material>
105
+ </flow_mat>
106
+ </itemfeedback>
107
+ </item>
108
+ </section>
109
+ </assessment>
110
+ </questestinterop>
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <manifest identifier="i0eca35dafa7480dfe690bbd94fecff5f" xmlns="http://www.imsglobal.org/xsd/imsccv1p1/imscp_v1p1" xmlns:lom="http://ltsc.ieee.org/xsd/imsccv1p1/LOM/resource" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsccv1p1/imscp_v1p1 http://www.imsglobal.org/xsd/imscp_v1p1.xsd http://ltsc.ieee.org/xsd/imsccv1p1/LOM/resource http://www.imsglobal.org/profile/cc/ccv1p1/LOM/ccv1p1_lomresource_v1p0.xsd http://www.imsglobal.org/xsd/imsmd_v1p2 http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd">
3
+ <metadata>
4
+ <schema>IMS Content</schema>
5
+ <schemaversion>1.1.3</schemaversion>
6
+ <imsmd:lom>
7
+ <imsmd:general>
8
+ <imsmd:title>
9
+ <imsmd:string>QTI Quiz Export for course "quizzes2"</imsmd:string>
10
+ </imsmd:title>
11
+ </imsmd:general>
12
+ <imsmd:lifeCycle>
13
+ <imsmd:contribute>
14
+ <imsmd:date>
15
+ <imsmd:dateTime>2017-07-18</imsmd:dateTime>
16
+ </imsmd:date>
17
+ </imsmd:contribute>
18
+ </imsmd:lifeCycle>
19
+ <imsmd:rights>
20
+ <imsmd:copyrightAndOtherRestrictions>
21
+ <imsmd:value>yes</imsmd:value>
22
+ </imsmd:copyrightAndOtherRestrictions>
23
+ <imsmd:description>
24
+ <imsmd:string>Private (Copyrighted) - http://en.wikipedia.org/wiki/Copyright</imsmd:string>
25
+ </imsmd:description>
26
+ </imsmd:rights>
27
+ </imsmd:lom>
28
+ </metadata>
29
+ <organizations/>
30
+ <resources>
31
+ <resource identifier="i6c88aaf29feba2ffa58a487a20665394" type="imsqti_xmlv1p2">
32
+ <file href="i6c88aaf29feba2ffa58a487a20665394/i6c88aaf29feba2ffa58a487a20665394.xml"/>
33
+ <dependency identifierref="i77eeb4cba7b69f032838c53a50bb9a31"/>
34
+ </resource>
35
+ <resource identifier="i77eeb4cba7b69f032838c53a50bb9a31" type="associatedcontent/imscc_xmlv1p1/learning-application-resource" href="i6c88aaf29feba2ffa58a487a20665394/assessment_meta.xml">
36
+ <file href="i6c88aaf29feba2ffa58a487a20665394/assessment_meta.xml"/>
37
+ </resource>
38
+ </resources>
39
+ </manifest>
@@ -51,4 +51,13 @@ describe Qti::V1::Models::Interactions::ChoiceInteraction do
51
51
 
52
52
  include_examples 'shuffled?'
53
53
  end
54
+
55
+ context 'multiple respconditions with empty setvars' do
56
+ let(:fixtures_path) { File.join('spec', 'fixtures', 'test_with_comments') }
57
+ let(:file_path) { File.join(fixtures_path, 'i6c88aaf29feba2ffa58a487a20665394', 'i6c88aaf29feba2ffa58a487a20665394.xml') }
58
+
59
+ it 'loads the items' do
60
+ expect(loaded_class.scoring_data_structs.count).to eq 1
61
+ end
62
+ end
54
63
  end
@@ -61,4 +61,16 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
61
61
  include_examples 'scoring_data_structs'
62
62
  include_examples 'stem_items'
63
63
  end
64
+
65
+ describe '#scoring_data_structs' do
66
+ let(:nodexml) { double }
67
+ subject { described_class.new(nodexml) }
68
+
69
+ it "returns 'no' as case default value" do
70
+ allow(nodexml).to receive(:at_xpath)
71
+ node = double(content: 'content', attributes: { 'respident' => double(value: 'a') })
72
+ allow(subject).to receive(:answer_nodes).and_return([node])
73
+ expect(subject.scoring_data_structs.first.case).to eq 'no'
74
+ end
75
+ end
64
76
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hannah Bottalla
@@ -383,6 +383,9 @@ files:
383
383
  - spec/fixtures/test_qti_2.2/multiple-choice/multiple-choice.xml
384
384
  - spec/fixtures/test_qti_2.2/text-entry/text-entry.xml
385
385
  - spec/fixtures/test_qti_2.2/true-false/true-false.xml
386
+ - spec/fixtures/test_with_comments/i6c88aaf29feba2ffa58a487a20665394/assessment_meta.xml
387
+ - spec/fixtures/test_with_comments/i6c88aaf29feba2ffa58a487a20665394/i6c88aaf29feba2ffa58a487a20665394.xml
388
+ - spec/fixtures/test_with_comments/imsmanifest.xml
386
389
  - spec/fixtures/tests/feedbackTest/assessment.xml
387
390
  - spec/fixtures/tests/feedbackTest/id-38d47747fb30/Example02-feedbackInline.xml
388
391
  - spec/fixtures/tests/feedbackTest/id-5e216df10030/Example03-feedbackBlock-solution.xml
@@ -626,6 +629,9 @@ test_files:
626
629
  - spec/fixtures/test_qti_2.2/multiple-choice/multiple-choice.xml
627
630
  - spec/fixtures/test_qti_2.2/text-entry/text-entry.xml
628
631
  - spec/fixtures/test_qti_2.2/true-false/true-false.xml
632
+ - spec/fixtures/test_with_comments/i6c88aaf29feba2ffa58a487a20665394/assessment_meta.xml
633
+ - spec/fixtures/test_with_comments/i6c88aaf29feba2ffa58a487a20665394/i6c88aaf29feba2ffa58a487a20665394.xml
634
+ - spec/fixtures/test_with_comments/imsmanifest.xml
629
635
  - spec/fixtures/tests/feedbackTest/assessment.xml
630
636
  - spec/fixtures/tests/feedbackTest/id-38d47747fb30/Example02-feedbackInline.xml
631
637
  - spec/fixtures/tests/feedbackTest/id-5e216df10030/Example03-feedbackBlock-solution.xml