EduploneExam_QOrderProcessor/QOrder_ProcessorTypes QOrderProcessGroup.py,1.1.1.1,1.2 QOrderProcessor.py,1.1.1.1,1.2 QOrderProcessGroup.pyc,1.1.1.1,NONE QOrderProcessor.pyc,1.1.1.1,NONE __init__.pyc,1.1.1.1,NONE

Nils Haagen <[email protected]> Mon, 26 Sep 2005 07:13:27 +0000
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneExam_QOrderProcessor/QOrder_ProcessorTypes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3812/QOrder_ProcessorTypes

Modified Files:
	QOrderProcessGroup.py QOrderProcessor.py 
Removed Files:
	QOrderProcessGroup.pyc QOrderProcessor.pyc __init__.pyc 
Log Message:
Aargau-Questionaire included; ProcessorView(Results) still faulty...

--- __init__.pyc DELETED ---

--- QOrderProcessor.pyc DELETED ---

Index: QOrderProcessor.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam_QOrderProcessor/QOrder_ProcessorTypes/QOrderProcessor.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** QOrderProcessor.py	19 Sep 2005 06:51:26 -0000	1.1.1.1
--- QOrderProcessor.py	26 Sep 2005 07:13:25 -0000	1.2
***************
*** 26,34 ****
  from Products.Archetypes.atapi import *
  
- 
- 
  from Products.EduploneExam_QOrderProcessor.config import *
  ##code-section module-header #fill in your manual code here
  from Products.EduploneExam.registry import registerAdditionalType
  ##/code-section module-header
  
--- 26,36 ----
  from Products.Archetypes.atapi import *
  
  from Products.EduploneExam_QOrderProcessor.config import *
+ 
  ##code-section module-header #fill in your manual code here
+ 
  from Products.EduploneExam.registry import registerAdditionalType
+ 
+ 
  ##/code-section module-header
  
***************
*** 45,49 ****
  
  ##code-section after-schema #fill in your manual code here
- 
  ##/code-section after-schema
  
--- 47,50 ----
***************
*** 60,64 ****
      allowed_content_types      = ['QOrderProcessGroup']
      filter_content_types       = 1
!     global_allow               = 0
      allow_discussion           = 0
      #content_icon               = 'QOrderProcessor.gif'
--- 61,65 ----
      allowed_content_types      = ['QOrderProcessGroup']
      filter_content_types       = 1
!     global_allow               = 1
      allow_discussion           = 0
      #content_icon               = 'QOrderProcessor.gif'
***************
*** 72,80 ****
--- 73,126 ----
  
      ##code-section class-header #fill in your manual code here
+     
+     actions =  (
+ 
+        {'action':      "string:$object_url/processor_view",
+         'category':    "object",
+         'id':          'view',
+         'name':        'processor_view',
+         'permissions': ("View",),
+         'condition'  : 'python:1'
+        },
+ 
+     )
      ##/code-section class-header
  
  
      #Methods
+     
+     ##questUID:groupUID:answerUID
+     
  
+     def get_Exam_OrderAnswers(self):
+         """returns dict of key=OrderQuestion, value=(question_title, question_UID, [OrderAnswers]) """
+         #let's assume, we're directly under ExamFolder/ExamPersistenceFolder for now...
+         ret={}
+         eXamFolder=self.aq_parent
+         for oq in eXamFolder.objectValues('OrderQuestion') :
+             ret[oq.getId()]=(oq.Title(), oq.UID(), oq.objectValues())
+         
+         return ret
+     
+     def get_Proc_OrderAnswers(self):
+         """ """
+         ret={}
+         for op in self.objectValues():
+             ret[op.getId()]=(op.Title(), op.get_AnswerUIDs())
+             
+         return ret
+     
+     def maxSumFeedback(self):
+         """ """
+         results={}
+         for pg in self.objectValues('QOrderProcessGroup'):
+             results[pg.sumUp()]=pg.getId()
+         
+         reslist=results.keys()
+         reslist.reverse()
+         return (self[results[reslist[0]]].Title(), self[results[reslist[0]]].getFeedback())
+         
+             
+         
  registerType(QOrderProcessor,PROJECTNAME)
  # end of class QOrderProcessor

--- QOrderProcessGroup.pyc DELETED ---

Index: QOrderProcessGroup.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam_QOrderProcessor/QOrder_ProcessorTypes/QOrderProcessGroup.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** QOrderProcessGroup.py	19 Sep 2005 06:51:26 -0000	1.1.1.1
--- QOrderProcessGroup.py	26 Sep 2005 07:13:25 -0000	1.2
***************
*** 26,36 ****
  from Products.Archetypes.atapi import *
  
- 
- 
  from Products.EduploneExam_QOrderProcessor.config import *
  ##code-section module-header #fill in your manual code here
  ##/code-section module-header
  
  schema=Schema((
  ),
  )
--- 26,47 ----
  from Products.Archetypes.atapi import *
  
  from Products.EduploneExam_QOrderProcessor.config import *
+ 
  ##code-section module-header #fill in your manual code here
+ 
+ from Products.CMFCore.utils import getToolByName
+ from Products.Archetypes.config import UID_CATALOG
  ##/code-section module-header
  
  schema=Schema((
+     TextField('Feedback',
+         widget=TextAreaWidget(
+             label='Feedback',
+             label_msgid='EduploneExam_QOrderProcessor_label_Feedback',
+             description_msgid='EduploneExam_QOrderProcessor_help_Feedback',
+             i18n_domain='EduploneExam_QOrderProcessor',
+         )
+     ),
+ 
  ),
  )
***************
*** 70,77 ****
--- 81,146 ----
  
      ##code-section class-header #fill in your manual code here
+         
+     actions =  (
+        {'action':      "string:$object_url/processgroup_edit",
+         'category':    "object",
+         'id':          'edit',
+         'name':        'processgroup_edit',
+         'permissions': ("Edit",),
+         'condition'  : 'python:1'
+        },
+     )
+ 
+     #questionUID:answerUID
+     _answerUIDs={}
+     
      ##/code-section class-header
  
  
      #Methods
+     def set_AnswerUIDs(self, uids={}):
+         """ """
+         self._answerUIDs=uids
+     
+     def get_AnswerUIDs(self):
+         """ """
+         return self._answerUIDs
+     
+     def getAnswerUIDforQuestion(self, question):
+         """ """
+         if self._answerUIDs.has_key(question):
+             return self._answerUIDs[question]
+         else:
+             return False
+     
+     
+     
+     def _lookupUID(self, uid, instance):
+         tool = getToolByName(instance, UID_CATALOG)
+         brains = tool(UID=uid)
+         for brain in brains:
+             obj = brain.getObject()
+             if obj is not None:
+                 return obj
+         else:
+             return None
+     
+         
+     def sumUp(self):
+         """ """
+         sum=0
+         for q in self._answerUIDs:
+             QObj=self._lookupUID(q, self)
+             singleAnswer=QObj.deliverResponse(QObj).getResponseValues()[self._answerUIDs[q]] 
+             try:
+                 singleAnswer=int(singleAnswer)
+             except:
+                 singleAnswer=0
+             
+             sum=sum+singleAnswer
+         
+         return sum
+                
+         
  
  registerType(QOrderProcessGroup,PROJECTNAME)



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php