Permalink
Browse files

add support for translating respondus FIMB questions, refs #5386

Change-Id: I0a9f6e277810c65f41d70122dec254f6cc3366dc
Reviewed-on: https://gerrit.instructure.com/5489
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
  • Loading branch information...
1 parent 8308f16 commit 48a4270f7b688752753bbca9784564b86e670ed0 @codekitchen codekitchen committed Sep 8, 2011
Showing with 36 additions and 3 deletions.
  1. +11 −3 lib/imsqti.py
  2. +25 −0 lib/imsqtiv1.py
View
@@ -1840,10 +1840,18 @@ class BaseValueOperator(Expression):
def __init__ (self,baseType,value):
self.baseType=baseType
self.value=value
-
+ self.identifier=None
+
+ def SetIdentifier(self, identifier):
+ self.identifier=identifier
+
def WriteXML (self,f):
- f.write('<baseValue baseType="'+XMLString(self.baseType)+'">'+XMLString(self.value)+'</baseValue>')
-
+ res = '<baseValue baseType="'+XMLString(self.baseType)+'"'
+ if self.identifier != None:
+ res = res + ' identifier="'+XMLString(self.identifier)+'"'
+ res = res + '>'+XMLString(self.value)+'</baseValue>'
+ f.write(res)
+
class IsNullOperator(Expression):
def __init__ (self,expression):
self.expression=expression
View
@@ -2830,6 +2830,25 @@ def CloseObject (self):
if self.data:
self.container.SetBBQuestionType(self.data)
+# RespondusQuestionType
+# -----------
+#
+
+class RespondusQuestionType(QTIObjectV1):
+ def __init__(self,name,attrs,parent):
+ self.parent=parent
+ self.data=""
+ self.label = name
+ self.container = self.GetInstructureHelperContainer()
+
+ def AddData (self,data):
+ self.data=self.data+data
+
+ def CloseObject (self):
+ QTIObjectV1.CloseObject(self)
+ if self.data:
+ self.container.SetQuestionType(self.data)
+
# wct_questioncategory
# -----------
#
@@ -2933,6 +2952,7 @@ def CloseObject (self):
# These are custom Respondus fields -- note they use qti_metadatafield
# rather than qtimetadatafield
'respondusapi_qpoints':BBMaxScore,
+ 'respondusapi_qtype':RespondusQuestionType,
# D2L Field
'questiontype':QMDItemType
@@ -5341,6 +5361,9 @@ def __init__(self,name,attrs,parent):
def SetAttribute_respident (self,value):
value = D2L_IDENTIFIER_REPLACER.sub('', value)
self.identifier=self.ReadIdentifier(value,RESPONSE_PREFIX)
+ if self.GetInstructureHelperContainer().question_type == 'fillInMultiple':
+ if not self.GetItemV1().GetResponse(self.identifier):
+ self.GetItemV1().DeclareResponse(self.identifier,'single','string')
def SetAttribute_index (self,value):
self.index=self.ReadInteger(value,None)
@@ -5376,6 +5399,8 @@ def MakeSingleValue (self,baseType):
elif baseType=='identifier':
self.value=self.CheckNMTOKEN(self.value,RESPONSE_PREFIX)
self.valExpression=BaseValueOperator(baseType,self.value)
+ if self.identifier:
+ self.valExpression.SetIdentifier(self.identifier)
self.valCardinality='single'

0 comments on commit 48a4270

Please sign in to comment.