- Timestamp:
- 29 Sep 2016, 08:54:32 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/batching.py
r13865 r14206 29 29 ICustomStudentOnlinePayment, 30 30 ICustomCourseTicketImport, 31 ICustomStudentStudyLevel, 32 ICustomStudentStudyCourse 31 33 ) 32 34 from waeup.kofa.students.batching import ( 33 35 StudentProcessor, StudentOnlinePaymentProcessor, 36 StudentStudyLevelProcessor, 37 StudentStudyCourseProcessor, 34 38 CourseTicketProcessor) 35 39 … … 46 50 iface = ICustomStudentOnlinePayment 47 51 52 class CustomStudentStudyCourseProcessor(StudentStudyCourseProcessor): 53 """ 54 """ 55 iface = ICustomStudentStudyCourse 56 57 class CustomStudentStudyLevelProcessor(StudentStudyLevelProcessor): 58 """ 59 """ 60 iface = ICustomStudentStudyLevel 61 48 62 class CustomCourseTicketProcessor(CourseTicketProcessor): 49 63 """A batch processor for ICourseTicket objects. -
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r14165 r14206 248 248 grok.context(ICustomStudentStudyLevel) 249 249 form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit( 250 'total_credits', 'gpa', 'level' )250 'total_credits', 'gpa', 'level', 'imported_gpa', 'imported_cgpa') 251 251 form_fields[ 252 252 'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') … … 278 278 form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit( 279 279 'level_session', 'level_verdict', 280 'validated_by', 'validation_date', 'gpa', 'level') 280 'validated_by', 'validation_date', 'gpa', 'level', 281 'imported_gpa', 'imported_cgpa') 281 282 282 283 omit_fields = ('password', 'suspended', 'suspended_comment', -
main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py
r14113 r14206 18 18 19 19 from zope import schema 20 from zope.interface import Attribute 20 21 from zc.sourcefactory.contextual import BasicContextualSourceFactory 21 22 from zope.catalog.interfaces import ICatalog … … 283 284 """ 284 285 286 imported_cgpa = schema.Float( 287 title = _(u'Imported Cumulative GPA'), 288 required = False, 289 readonly = True, 290 ) 291 285 292 class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): 286 293 """A container for course tickets. … … 305 312 readonly = True, 306 313 ) 314 315 imported_gpa = schema.Float( 316 title = _(u'Imported Level GPA'), 317 required = False, 318 readonly = True, 319 ) 320 321 imported_cgpa = schema.Float( 322 title = _(u'Imported Cumulative GPA'), 323 required = False, 324 readonly = True, 325 ) 326 307 327 308 328 class ICustomStudentOnlinePayment(ICustomOnlinePayment): -
main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py
r14161 r14206 87 87 if credits_counted: 88 88 level_gpa = round(credits_weighted/credits_counted, 3) 89 # Override level_gpa if value has been imported 90 imported_gpa = getattr(self, 'imported_gpa', None) 91 if imported_gpa: 92 level_gpa = imported_gpa 89 93 return level_gpa, credits_counted, credits_weighted 90 94 -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r14165 r14206 43 43 44 44 45 class StudentProcessorTest(FunctionalTestCase):46 """Perform some batching tests.47 """48 49 layer = FunctionalLayer50 51 def setUp(self):52 super(StudentProcessorTest, self).setUp()53 # Setup a sample site for each test54 app = University()55 self.dc_root = tempfile.mkdtemp()56 app['datacenter'].setStoragePath(self.dc_root)57 58 # Prepopulate the ZODB...59 self.getRootFolder()['app'] = app60 # we add the site immediately after creation to the61 # ZODB. Catalogs and other local utilities are not setup62 # before that step.63 self.app = self.getRootFolder()['app']64 # Set site here. Some of the following setup code might need65 # to access grok.getSite() and should get our new app then66 setSite(app)67 68 69 def tearDown(self):70 super(StudentProcessorTest, self).tearDown()71 shutil.rmtree(self.workdir)72 shutil.rmtree(self.dc_root)73 clearSite()74 return75 76 45 UPLOAD_CSV_TEMPLATE = ( 77 46 'matric_number,student_id,display_fullname,level,code,level_session,' … … 144 113 self.assertEqual(self.student['studycourse']['100'].gpa_params[2], 82.0) 145 114 # sgpa = 82 / 23 146 self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 3.565) 115 self.assertEqual( 116 self.student['studycourse']['100'].gpa_params[0], 3.565) 117 # imported gpa values override calculated values 118 studylevel.imported_gpa = 4.3 119 studylevel.imported_cgpa = 5.4 120 self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 4.3) 121 self.assertEqual( 122 self.student['studycourse']['100'].cumulative_params[0], 5.4) 123 self.assertEqual(self.student['studycourse']['100'].gpa, 4.3) 124 self.student['studycourse'].imported_cgpa = 6.6 125 self.assertEqual( 126 self.student['studycourse'].getTranscriptData()[1], 6.6) 147 127 return 148 128 -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_export.py
r14111 r14206 138 138 self.assertEqual( 139 139 result, 140 'gpa,level,level_session,level_verdict,total_credits,' 140 'gpa,imported_cgpa,imported_gpa,' 141 'level,level_session,level_verdict,total_credits,' 141 142 'total_credits_s1,total_credits_s2,' 142 143 'validated_by,validation_date,' 143 144 'student_id,number_of_tickets,certcode\r\n' 144 '0.0, 100,2012,A,100,,,,,A111111,1,CERT1\r\n'145 '0.0,,,100,2012,A,100,,,,,A111111,1,CERT1\r\n' 145 146 ) 146 147 return
Note: See TracChangeset for help on using the changeset viewer.