Changeset 8591 for main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Timestamp:
- 1 Jun 2012, 11:25:22 (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
r8570 r8591 1 <h2 i18n:domain="waeup.kofa">Container Statistics</h2> 2 3 <table i18n:domain="waeup.kofa"> 4 <thead> 5 <tr> 6 <th i18n:translate="">Application State</th> 7 <th i18n:translate="">Number of Applicants</th> 8 </tr> 9 </thead> 10 <tbody tal:define="stats context/statistics"> 11 <tr tal:repeat="state python:('initialized', 12 'started','paid','submitted','admitted','not admitted', 13 'created')"> 14 <td tal:content="state">STATE</td> 15 <td tal:content="python: stats[state] ">NUMBER</td> 16 </tr> 17 </tbody> 18 </table> 1 <tal:statistics define="stats context/statistics" i18n:domain="waeup.kofa"> 2 <h2 i18n:translate="">Container Statistics</h2> 3 <table class="span8"> 4 <thead> 5 <tr> 6 <th i18n:translate="" width="40%">Application State</th> 7 <th i18n:translate="">Number of Applicants</th> 8 </tr> 9 </thead> 10 <tbody> 11 <tr tal:repeat="state python:('initialized', 12 'started','paid','submitted','admitted','not admitted', 13 'created')"> 14 <td tal:content="state">STATE</td> 15 <td tal:content="python: stats[0][state] ">NUMBER</td> 16 </tr> 17 </tbody> 18 </table> 19 <table class="span8"> 20 <thead> 21 <tr> 22 <th i18n:translate="" width="40%">Faculty</th> 23 <th> </th> 24 </tr> 25 </thead> 26 <tbody> 27 <tr tal:repeat="fac python:stats[1].keys()"> 28 <td tal:content="fac">FAC</td> 29 <td tal:content="python: stats[1][fac] ">NUMBER</td> 30 </tr> 31 </tbody> 32 </table> 33 </tal:statistics> -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/container.py
r8563 r8591 99 99 @property 100 100 def statistics(self): 101 stat istics = {INITIALIZED:0, STARTED:0, PAID:0, SUBMITTED:0,101 state_stats = {INITIALIZED:0, STARTED:0, PAID:0, SUBMITTED:0, 102 102 ADMITTED:0, NOT_ADMITTED:0, CREATED:0} 103 faculty_keys = grok.getSite()['faculties'].keys() 104 fac_stats = dict([(i,0) for i in faculty_keys]) 103 105 for key in self.keys(): 104 statistics[self[key].state] += 1 105 return statistics 106 state_stats[self[key].state] += 1 107 cert = getattr(self[key],'course1',None) 108 if cert is not None: 109 faculty = cert.__parent__.__parent__.__parent__ 110 fac_stats[faculty.__name__] += 1 111 return state_stats, fac_stats 106 112 107 113 ApplicantsContainer = attrs_to_fields(ApplicantsContainer) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r8590 r8591 131 131 # because managers are allowed to edit this required field 132 132 self.applicant.reg_number = u'1234' 133 self.applicant.course1 = certificate 133 134 app['applicants']['app2009'].addApplicant(self.applicant) 134 135 IUserAccount( … … 376 377 self.assertTrue('<td>initialized</td>' in self.browser.contents) 377 378 self.assertTrue('<td>1</td>' in self.browser.contents) 378 self.assertEqual(self.applicantscontainer.statistics ,379 self.assertEqual(self.applicantscontainer.statistics[0], 379 380 {'not admitted': 0, 'started': 0, 'created': 0, 380 381 'admitted': 0, 'submitted': 0, 'initialized': 1, 'paid': 0}) 382 self.assertEqual(self.applicantscontainer.statistics[1], 383 {u'fac1': 1}) 381 384 return 382 385
Note: See TracChangeset for help on using the changeset viewer.