EduploneExam/questions FillGapQuestion.py,1.22,1.23

"Fabian K." <[email protected]> Sat, 02 Apr 2005 11:50:37 +0000
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneExam/questions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2094/questions

Modified Files:
	FillGapQuestion.py 
Log Message:
Added move gap feature for fillgap question types

Index: FillGapQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/FillGapQuestion.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** FillGapQuestion.py	31 Mar 2005 00:18:55 -0000	1.22
--- FillGapQuestion.py	2 Apr 2005 11:50:34 -0000	1.23
***************
*** 93,107 ****
          possibleCorrect=len(answerObjects) #is not the case for i.e. maching
          score=self.getMaxScore() / possibleCorrect * correctCounter
!         responseObj.setScore(score)
  
      def getGapPosition(self, gapId):
          """
          """
!         counter=0
!         for word in self.getBasetext().split(' '):
!             if word=='<id=\'%s\'>' % gapId:
                  return counter
!             counter+=1;
! 
  
      # uncomment lines below when you need
--- 93,122 ----
          possibleCorrect=len(answerObjects) #is not the case for i.e. maching
          score=self.getMaxScore() / possibleCorrect * correctCounter
!         responseObj.setScore(score)
! 
!     def getBasetextAsList(self):
!         """ Returns FillGap's base text as splitted list, each item
!             is one word.
!         """
!         return self.getBasetext().split(" ")
  
      def getGapPosition(self, gapId):
          """
          """
!         counter = 0
!         for word in self.getBasetext().split(" "):
!             if word=="<id='%s'>" % gapId:
                  return counter
!             counter += 1            
! 
!     def getWordById(self, gapId):
!         """ Returns word by given ID <gapId>. """
!         return self.getBasetextAsList()[gapId]
! 
!     def isGap(self, gapId):
!         """ Returns True if given ID <gapId> is a valid gap. """
!         basetext = self.getBasetextAsList()
!         return basetext[gapId].startswith("<id='") and basetext[gapId].endswith("'>")
!     
  
      # uncomment lines below when you need



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click