Skip to content

Commit

Permalink
Consume 2.2 item packages
Browse files Browse the repository at this point in the history
closes: QUIZ-3453

test plan:
1. import a 2.2 item package
2. verify it imports

Change-Id: I35ac23d5be3f9e9bda4ee1d723d323a215ece2e9
Reviewed-on: https://gerrit.instructure.com/134451
Tested-by: Jenkins
Reviewed-by: Han Yan <[email protected]>
QA-Review: Michael Hanks <[email protected]>
Product-Review: Hannah Bottalla <[email protected]>
  • Loading branch information
hannahb0t committed Dec 11, 2017
1 parent 41a76e6 commit 05bc531
Show file tree
Hide file tree
Showing 110 changed files with 593 additions and 361 deletions.
3 changes: 2 additions & 1 deletion lib/qti/models/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def qti_2_x_href
end

def qti_2_non_assessment_href
item_path = @doc.at_xpath("//xmlns:resources/xmlns:resource[@type='imsqti_item_xmlv2p1']/@href")&.content
item_path = @doc.at_xpath("//xmlns:resources/xmlns:resource[@type='imsqti_item_xmlv2p1']/@href")&.content ||
@doc.at_xpath("//xmlns:resources/xmlns:resource[@type='imsqti_item_xmlv2p2']/@href")
Qti::V2::Models::NonAssessmentTest.from_path!(@path, @package_root) if item_path
end

Expand Down
10 changes: 9 additions & 1 deletion lib/qti/v2/models/non_assessment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class NonAssessmentTest < Qti::V2::Models::AssessmentTest
def assessment_items
# Return the xml files we should be parsing
@assessment_item_reference_hrefs ||= begin
@doc.xpath("//xmlns:resource[@type='imsqti_item_xmlv2p1']/@href").map do |href|
hrefs.map do |href|
remap_href_path(href)
end
end
Expand All @@ -20,6 +20,14 @@ def stimulus_ref(assessment_item_ref)
href = xpath_with_single_check("//xmlns:resource[@identifier='#{dependencies.first}']/@href")
remap_href_path(href)
end

def hrefs
if xpath_with_single_check("//xmlns:resource[@type='imsqti_item_xmlv2p1']/@href")&.value
@doc.xpath("//xmlns:resource[@type='imsqti_item_xmlv2p1']/@href")
else xpath_with_single_check("//xmlns:resource[@type='imsqti_item_xmlv2p2']/@href")&.value
@doc.xpath("//xmlns:resource[@type='imsqti_item_xmlv2p2']/@href")
end
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/qti/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Qti
VERSION = '0.9.4'.freeze
VERSION = '0.9.5'.freeze
end
4 changes: 1 addition & 3 deletions spec/fixtures/items_2.1/Example02-feedbackInline.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This item is a true/false question with inline feedback, adapted from the CC question QUE_102010.xml -->
<assessmentItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"
xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" identifier="Example02-feedbackInline"
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p2.xsd" identifier="Example02-feedbackInline"
title="Example 2 - inline feedback" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier">
<correctResponse>
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/items_2.1/categorization.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd" identifier="match" title="Characters and Plays" adaptive="false" timeDependent="false">
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p2.xsd" identifier="match" title="Characters and Plays" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="multiple" baseType="directedPair">
<correctResponse>
<value>C R</value>
Expand Down
53 changes: 25 additions & 28 deletions spec/fixtures/items_2.1/choice.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Thie example adapted from the PET Handbook, copyright University of Cambridge ESOL Examinations -->
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"
identifier="choice" title="Unattended Luggage" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier">
<correctResponse>
<value>ChoiceA</value>
</correctResponse>
</responseDeclaration>
<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float">
<defaultValue>
<value>0</value>
</defaultValue>
</outcomeDeclaration>
<itemBody>
<p>Look at the text in the picture.</p>
<p>
<img src="images/sign.png" alt="NEVER LEAVE LUGGAGE UNATTENDED"/>
</p>
<choiceInteraction responseIdentifier="RESPONSE" shuffle="TRUE" maxChoices="1">
<prompt>What does it say?</prompt>
<simpleChoice identifier="ChoiceA">You must stay with your luggage at all times.</simpleChoice>
<simpleChoice identifier="ChoiceB">Do not let someone else look after your luggage.</simpleChoice>
<simpleChoice identifier="ChoiceC">Remember your luggage when you leave.</simpleChoice>
</choiceInteraction>
</itemBody>
<responseProcessing
template="http://www.imsglobal.org/question/qti_v2p2/rptemplates/match_correct"/>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p2.xsd" identifier="choice" title="Unattended Luggage" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier">
<correctResponse>
<value>ChoiceA</value>
</correctResponse>
</responseDeclaration>
<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float">
<defaultValue>
<value>0</value>
</defaultValue>
</outcomeDeclaration>
<itemBody>
<p>Look at the text in the picture.</p>
<p>
<img src="images/sign.png" alt="NEVER LEAVE LUGGAGE UNATTENDED"/>
</p>
<choiceInteraction responseIdentifier="RESPONSE" shuffle="TRUE" maxChoices="1">
<prompt>What does it say?</prompt>
<simpleChoice identifier="ChoiceA">You must stay with your luggage at all times.</simpleChoice>
<simpleChoice identifier="ChoiceB">Do not let someone else look after your luggage.</simpleChoice>
<simpleChoice identifier="ChoiceC">Remember your luggage when you leave.</simpleChoice>
</choiceInteraction>
</itemBody>
<responseProcessing
template="http://www.imsglobal.org/question/qti_v2p2/rptemplates/match_correct"/>
</assessmentItem>
5 changes: 1 addition & 4 deletions spec/fixtures/items_2.1/essay.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"
identifier="essay" title="Write an essay" adaptive="false" timeDependent="false">
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p2.xsd" identifier="essay" title="Write an essay" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="string"/>
<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float" externalScored="human" normalMaximum="25"/>
<itemBody>
Expand Down
69 changes: 33 additions & 36 deletions spec/fixtures/items_2.1/extended_text_rubric.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Thie example adapted from the PET Handbook, copyright University of Cambridge ESOL Examinations -->
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"
identifier="extendedText" title="Writing a Postcard with rubric" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="string"/>
<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float"/>
<itemBody>
<p>Read this postcard from your English pen-friend, Sam.</p>
<div>
<object type="image/png" data="images/postcard.png">
<blockquote class="postcard">
<p>Here is a postcard of my town. Please send me<br/> a postcard from your town.
What size is your<br/> town? What is the nicest part of your town?<br/>
Where do you go in the evenings?<br/> Sam.</p>
</blockquote>
</object>
</div>
<extendedTextInteraction responseIdentifier="RESPONSE" expectedLength="200">
<prompt>Write Sam a postcard. Answer the questions. Write 25-35 words.</prompt>
</extendedTextInteraction>
<rubricBlock view="scorer">
<h1>Scoring Guidelines</h1>
<div>
<p><b>Max Score:</b> 3.0 points</p>
<p><b>Scoring:</b></p>
<ul>
<li>When not all 3 questions are answered in the response: -1 for each missing.</li>
<li>Check for gramatical errors: -0.1 per error.</li>
<li>Possibly add in .1 increments extra bonus points for extra good answers.</li>
</ul>
</div>
</rubricBlock>
</itemBody>
</assessmentItem>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Thie example adapted from the PET Handbook, copyright University of Cambridge ESOL Examinations -->
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p2.xsd" identifier="extendedText" title="Writing a Postcard with rubric" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="string"/>
<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float"/>
<itemBody>
<p>Read this postcard from your English pen-friend, Sam.</p>
<div>
<object type="image/png" data="images/postcard.png">
<blockquote class="postcard">
<p>Here is a postcard of my town. Please send me<br/> a postcard from your town.
What size is your<br/> town? What is the nicest part of your town?<br/>
Where do you go in the evenings?<br/> Sam.</p>
</blockquote>
</object>
</div>
<extendedTextInteraction responseIdentifier="RESPONSE" expectedLength="200">
<prompt>Write Sam a postcard. Answer the questions. Write 25-35 words.</prompt>
</extendedTextInteraction>
<rubricBlock view="scorer">
<h1>Scoring Guidelines</h1>
<div>
<p><b>Max Score:</b> 3.0 points</p>
<p><b>Scoring:</b></p>
<ul>
<li>When not all 3 questions are answered in the response: -1 for each missing.</li>
<li>Check for gramatical errors: -0.1 per error.</li>
<li>Possibly add in .1 increments extra bonus points for extra good answers.</li>
</ul>
</div>
</rubricBlock>
</itemBody>
</assessmentItem>
5 changes: 1 addition & 4 deletions spec/fixtures/items_2.1/gap_match.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"
identifier="gapMatch" title="Richard III (Take 1)" adaptive="false" timeDependent="false">
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p2.xsd" identifier="gapMatch" title="Richard III (Take 1)" adaptive="false" timeDependent="false">
<responseDeclaration identifier="RESPONSE" cardinality="multiple" baseType="directedPair">
<correctResponse>
<value>W G1</value>
Expand Down
Loading

0 comments on commit 05bc531

Please sign in to comment.