Changeset 8643 for main/waeup.kofa/trunk/src
- Timestamp:
- 7 Jun 2012, 13:02:56 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicantcontainerstatistics.pt
r8601 r8643 17 17 </tbody> 18 18 </table> 19 <table class="span8" >19 <table class="span8" tal:condition="python: stats[1]"> 20 20 <thead> 21 21 <tr> -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/container.py
r8601 r8643 21 21 from random import SystemRandom as r 22 22 import grok 23 from zope.component import getUtility 23 24 from zope.component.factory import Factory 24 25 from zope.component.interfaces import IFactory 26 from zope.catalog.interfaces import ICatalog 25 27 from waeup.kofa.interfaces import MessageFactory as _ 26 28 from waeup.kofa.applicants.interfaces import ( … … 98 100 99 101 @property 100 def statistics(self):102 def unused_statistics(self): 101 103 state_stats = {INITIALIZED:0, STARTED:0, PAID:0, SUBMITTED:0, 102 104 ADMITTED:0, NOT_ADMITTED:0, CREATED:0} … … 111 113 fac_stats[faculty.__name__] += 1 112 114 return state_stats, fac_stats 115 116 @property 117 def statistics(self): 118 state_stats = {INITIALIZED:0, STARTED:0, PAID:0, SUBMITTED:0, 119 ADMITTED:0, NOT_ADMITTED:0, CREATED:0} 120 cat = getUtility(ICatalog, name='applicants_catalog') 121 code = self.code 122 year = int(code[-4:]) 123 target = code[:-4] 124 mxcode = target + str(year + 1) 125 for state in state_stats: 126 state_stats[state] = len(cat.searchResults( 127 state=(state, state), 128 applicant_id=(code, mxcode))) 129 return state_stats, None 113 130 114 131 ApplicantsContainer = attrs_to_fields(ApplicantsContainer) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r8637 r8643 381 381 {'not admitted': 0, 'started': 0, 'created': 0, 382 382 'admitted': 0, 'submitted': 0, 'initialized': 1, 'paid': 0}) 383 self.assertEqual(self.applicantscontainer.statistics[1],384 {u'fac1': 0})383 #self.assertEqual(self.applicantscontainer.statistics[1], 384 # {u'fac1': 0}) 385 385 IWorkflowState(self.applicant).setState('submitted') 386 notify(grok.ObjectModifiedEvent(self.applicant)) 386 387 self.assertEqual(self.applicantscontainer.statistics[0], 387 388 {'not admitted': 0, 'started': 0, 'created': 0, 388 389 'admitted': 0, 'submitted': 1, 'initialized': 0, 'paid': 0}) 389 self.assertEqual(self.applicantscontainer.statistics[1],390 {u'fac1': 1})390 #self.assertEqual(self.applicantscontainer.statistics[1], 391 # {u'fac1': 1}) 391 392 return 392 393
Note: See TracChangeset for help on using the changeset viewer.