EduploneExam/questions BaseExamQuestion.py,1.18,1.19 FreeTextQuestion.py,1.15,1.16

Nils Haagen <[email protected]>
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-serv4644/questions

Modified Files:
	BaseExamQuestion.py FreeTextQuestion.py 
Log Message:
it starts to grow skin..... 

Index: FreeTextQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/FreeTextQuestion.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** FreeTextQuestion.py	15 Dec 2004 14:37:02 -0000	1.15
--- FreeTextQuestion.py	16 Dec 2004 11:14:49 -0000	1.16
***************
*** 73,80 ****
  
      def processResponse(self, REQUEST):
          '''
!         
!         '''
          responseObj=BaseExamQuestion.processResponse(self, REQUEST)
  
  
--- 73,108 ----
  
      def processResponse(self, REQUEST):
+         ''' 
          '''
!         #get an responseObject from BaseExamQuestion
!         #context and question are set
          responseObj=BaseExamQuestion.processResponse(self, REQUEST)
+         
+         kw={} #Dict
+         possibleCorrect=0
+         correctCounter=0
+         score=0
+         answerObjects=self.objectValues(['FreeTextAnswer'])
+         
+         sUID=self.UID() 
+         kw[sUID]=REQUEST.get(sUID, '')
+         
+         #with a text-input, answers are not mandatory
+         if len(answerObjects)>0:
+             possibleCorrect=len(answerObjects)
+             #process Answer
+             for answer in answerObjects:
+                 if answer.processValue(kw[sUID]):
+                     correctCounter += 1
+             #now calculate score
+             possibleCorrect=len(answerObjects)
+             score=self.getMaxScore() / possibleCorrect * correctCounter
+                     
+                 
+         #fill in actual user-input as answer and set score
+         responseObj.setResponseValues(kw)
+         responseObj.setScore(score)
+         
+ 
  
  

Index: BaseExamQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/BaseExamQuestion.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** BaseExamQuestion.py	15 Dec 2004 15:55:15 -0000	1.18
--- BaseExamQuestion.py	16 Dec 2004 11:14:49 -0000	1.19
***************
*** 155,166 ****
      def processResponse(self,REQUEST):
          '''
!         gets a request.RESPONSE and returns an evaluated ExamResponse
!         object
          '''
!         #creating/loading a responseObject
!         
!         responseObj=self.deliverResponse(self)
          responseObj.setQuestion(self)
- 
          return responseObj
  
--- 155,163 ----
      def processResponse(self,REQUEST):
          '''
!         gets a REQUEST and returns an ExamResponse object
          '''
!         #creating/loading an allmost responseObject
!         responseObj=self.deliverResponse(self, create=True)
          responseObj.setQuestion(self)
          return responseObj
  



-------------------------------------------------------
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://productguide.itmanagersjournal.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.