EduploneExam/questions BaseExamQuestion.py,1.16,1.17 FillGapQuestion.py,1.14,1.15 FreeTextQuestion.py,1.14,1.15 MatchingQuestion.py,1.14,1.15 MathQuestion.py,1.14,1.15 MultipleChoiceQuestion.py,1.14,1.15 SingleChoiceQuestion.py,1.14,1.15 TextTaskQuestion.py,1.14,1.15 TrueFalseQuestion.py,1.14,1.15
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-serv5147/questions
Modified Files:
BaseExamQuestion.py FillGapQuestion.py FreeTextQuestion.py
MatchingQuestion.py MathQuestion.py MultipleChoiceQuestion.py
SingleChoiceQuestion.py TextTaskQuestion.py
TrueFalseQuestion.py
Log Message:
testProcessREsponse
Index: FreeTextQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/FreeTextQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** FreeTextQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- FreeTextQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,8 ****
# File: FreeTextQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
Index: FillGapQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/FillGapQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** FillGapQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- FillGapQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,11 ****
# File: FillGapQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
- #
# Generated: Wed Dec 15 14:24:36 2004
# Generator: ArchGenXML Version 1.2 devel 3 http://sf.net/projects/archetypes/
--- 1,5 ----
***************
*** 94,97 ****
--- 88,120 ----
)
+
+ def processResponse(self, REQUEST):
+ '''
+ '''
+ #get an responseObject from BaseExamQuestion
+ #context and question are set
+ responseObj=BaseExamQuestion.processResponse(self, REQUEST)
+
+ kw={} #Dict
+ correctCounter=0
+ answerObjects=self.objectValues(['MultipleChoiceAnswer'])
+
+ for answer in answerObjects:
+ awUId=answer.UID()
+ reqKey='##'.join((self.UID(), awUId))
+ kw[awUId]=REQUEST.get(reqKey, False)
+
+ #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)
+
registerType(FillGapQuestion)
Index: TrueFalseQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/TrueFalseQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** TrueFalseQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- TrueFalseQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,8 ****
# File: TrueFalseQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
Index: MathQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/MathQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** MathQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- MathQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,8 ****
# File: MathQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
Index: MatchingQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/MatchingQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** MatchingQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- MatchingQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,8 ****
# File: MatchingQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
Index: TextTaskQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/TextTaskQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** TextTaskQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- TextTaskQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,8 ****
# File: TextTaskQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
Index: SingleChoiceQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/SingleChoiceQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** SingleChoiceQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- SingleChoiceQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,8 ****
# File: SingleChoiceQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
Index: MultipleChoiceQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/MultipleChoiceQuestion.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** MultipleChoiceQuestion.py 15 Dec 2004 13:56:04 -0000 1.14
--- MultipleChoiceQuestion.py 15 Dec 2004 14:37:02 -0000 1.15
***************
*** 1,8 ****
# File: MultipleChoiceQuestion.py
- """\
- get values from request and returns an evaluated response
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
***************
*** 79,82 ****
--- 74,104 ----
#Methods
+ def processResponse(self, REQUEST):
+ '''
+ '''
+ #get an responseObject from BaseExamQuestion
+ #context and question are set
+ responseObj=BaseExamQuestion.processResponse(self, REQUEST)
+
+ kw={} #Dict
+ correctCounter=0
+ answerObjects=self.objectValues(['MultipleChoiceAnswer'])
+
+ for answer in answerObjects:
+ awUId=answer.UID()
+ reqKey='##'.join((self.UID(), awUId))
+ kw[awUId]=REQUEST.get(reqKey, False)
+
+ #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)
Index: BaseExamQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/BaseExamQuestion.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** BaseExamQuestion.py 15 Dec 2004 13:56:04 -0000 1.16
--- BaseExamQuestion.py 15 Dec 2004 14:37:02 -0000 1.17
***************
*** 1,8 ****
# File: BaseExamQuestion.py
- """\
- unknown
-
- RCS-ID $Id$
- """
# Copyright (c) 2004 by eduplone Open Source Business Network EEIG, contributed
# by FH-Aargau, Switzerland
--- 1,3 ----
***************
*** 163,170 ****
object
'''
! #creating an responseObject
! contextObj=self.getContext()
! responseObj=contextObj.deliverResponse()
! responseObj.setContext(contextObj)
responseObj.setQuestion(self)
--- 158,164 ----
object
'''
! #creating/loading a responseObject
!
! responseObj=self.deliverResponse(self)
responseObj.setQuestion(self)
***************
*** 181,192 ****
#manually created methods
- def getContext(self):
- '''
-
- '''
-
- pass
-
-
# uncomment lines below when you need
--- 175,178 ----
-------------------------------------------------------
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/