EduploneExam/questions FillGapQuestion.py,1.23,1.24

Nils Haagen <[email protected]> Sat, 02 Apr 2005 21:21:45 +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-serv23588/questions

Modified Files:
	FillGapQuestion.py 
Log Message:
fillgap is coming somewhere

Index: FillGapQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/FillGapQuestion.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** FillGapQuestion.py	2 Apr 2005 11:50:34 -0000	1.23
--- FillGapQuestion.py	2 Apr 2005 21:21:38 -0000	1.24
***************
*** 76,80 ****
          kw={} #Dict
          correctCounter=0
!         answerObjects=self.objectValues(['MultipleChoiceAnswer'])
          
          for answer in answerObjects:
--- 76,80 ----
          kw={} #Dict
          correctCounter=0
!         answerObjects=self.objectValues()
          
          for answer in answerObjects:
***************
*** 84,102 ****
              
              #process Answer (see, if correct and increase counter if so)
!             if self[awUId].processValue(kw[awUId]):
                  correctCounter += 1
              
          #fill in actual user-input as answers
!         responseObj.setResponseValues(kw)
  
          #now calculate and set score
          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(" ")
  
--- 84,103 ----
              
              #process Answer (see, if correct and increase counter if so)
!             if answer.processValue(kw[awUId]):
                  correctCounter += 1
              
          #fill in actual user-input as answers
!         responseObj.setResponseValues(**kw)
  
          #now calculate and set score
          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(" ")
  
***************
*** 108,121 ****
              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("'>")
      
  
--- 109,122 ----
              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("'>")
      
  



-------------------------------------------------------
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