Changeset 398
- Timestamp:
- 21 Aug 2006, 14:29:27 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Academics.py
r389 r398 616 616 portal_type = meta_type 617 617 security = ClassSecurityInfo() 618 def getCourseEntry(self,cid): 619 res = self.portal_catalog({'meta_type': "Course", 620 'id': cid}) 621 if res: 622 return res[-1] 623 else: 624 return None 625 626 security.declareProtected(View,"Title") 627 def Title(self): 628 """compose title""" 629 ce = self.getCourseEntry(self.id.upper()) 630 if ce: 631 return "%s" % ce.Title 632 return "No such course" 618 633 619 634 InitializeClass(CourseTicket) -
WAeUP_SRP/trunk/Students.py
r396 r398 19 19 p_home = Globals.package_home(globals()) 20 20 i_home = Globals.INSTANCE_HOME 21 MAX_TRANS = 1000 21 22 22 23 class StudentsFolder(CPSDocument): ###( … … 32 33 """load Fulltime Studentdata from CSV values""" 33 34 #return 35 import transaction 36 tr_count = 0 34 37 name = 'short_full_time' 35 38 no_import = False … … 64 67 continue 65 68 certcode = makeCertificateCode(student.get('CourseMajor')) 66 if sid in students_added:67 em = 'Student with ID %(MatricNo)s %(fullname)s already exists in this import\n' % student68 logger.info(em)69 no_import.write(em)70 no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)71 continue69 ## if sid in students_added: 70 ## em = 'Student with ID %(MatricNo)s %(fullname)s already exists in this import\n' % student 71 ## logger.info(em) 72 ## no_import.write(em) 73 ## no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student) 74 ## continue 72 75 s = studs.get(sid,None) 73 76 if certcode not in certs.keys(): … … 92 95 s = getattr(self,sid) 93 96 students_added.append(sid) 97 studs[sid] = s 94 98 s.invokeFactory('StudentPersonal','personal') 95 99 sp = s.personal … … 153 157 no_import.write(em) 154 158 no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student) 159 if tr_count > MAX_TRANS: 160 #transaction.commit() 161 #em = '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Transaction commited\n' % student 162 logger.info(em) 163 tr_count = 0 164 tr_count += 1 155 165 return self.students.academics_contents() 156 166 ###) 157 167 158 security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsResultsFromCSV") 168 security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsResultsFromCSV") ###( 159 169 def loadFullTimeStudentsResultsFromCSV(self): 160 170 """load Fulltime Studentdata from CSV values""" 161 171 #return 162 name = 'short_full_time_results_2004_2005.csv' 172 import transaction 173 tr_count = 0 174 name = 'short_full_time_results_2004_2005' 163 175 no_import = False 164 176 if not no_import: … … 177 189 for s in l: 178 190 students[s.id] = s.getObject() 179 courses = self.portal_catalog({'meta_type': "Course"}) 191 l = self.portal_catalog({'meta_type': "Course"}) 192 courses = {} 193 for c in l: 194 courses[c.id] = c.getObject() 180 195 for result in results: 181 196 sid = result.get('Matnumber') 182 197 if sid not in students.keys(): 183 em = 'Student with ID %(Matnumber)s not found\n' % student184 logger.info(em) 185 no_import.write(em) 186 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % student)198 em = 'Student with ID %(Matnumber)s not found\n' % result 199 logger.info(em) 200 no_import.write(em) 201 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result) 187 202 continue 188 if student.get('CosCode') not in courses: 189 em = 'Course with ID %(CosCode)s not found\n' % student 190 logger.info(em) 191 no_import.write(em) 192 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % student) 203 course = result.get('CosCode') 204 if course not in courses.keys(): 205 em = 'Course with ID %(CosCode)s not found\n' % result 206 logger.info(em) 207 no_import.write(em) 208 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result) 193 209 continue 194 level = student.get('Level')210 level = result.get('Level') 195 211 try: 196 212 int(level) 197 213 except: 198 em = 'Result for Student with ID %(Matnumber)s Course %(CosCode)s Level is empty\n' % student199 logger.info(em) 200 no_import.write(em) 201 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % student)214 em = 'Result for result with ID %(Matnumber)s Course %(CosCode)s Level is empty\n' % result 215 logger.info(em) 216 no_import.write(em) 217 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result) 202 218 continue 203 219 sf = students.get(sid) … … 206 222 if l is None: 207 223 #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 208 logger.info('Creating Level %( StudentLevel)s for %(fullname)s' % student)224 logger.info('Creating Level %(Level)s for %(Matnumber)s' % result) 209 225 sc.invokeFactory('StudyLevel', level) 210 226 l = getattr(sc, level) … … 216 232 second_s = getattr(l,'second') 217 233 second_s.getContent().edit(mapping={'Title': 'Second Semester'}) 218 snr = student.get('Semester')234 snr = result.get('Semester') 219 235 semester = getattr(l,'first') 220 if snr == " 1":236 if snr == "2": 221 237 semester = getattr(l,'second') 238 logger.info('Creating CourseTicket %(CourseTicket)s in Level %(Level)s for %(Matnumber)s' % result) 239 semester.invokeFactory('CourseTicket',course) 240 ct = getattr(semester,course) 241 d = {} 242 d['ansbook'] = result.get('Ansbook') 243 d['status'] = result.get('CosStuatus') 244 d['score'] = result.get('Score') 245 d['carry_level'] = result.get('CarryLevel') 246 d['grade'] = result.get('Grade') 247 d['weight'] = result.get('Weight') 248 d['verdict'] = result.get('Verdict') 249 d['import_id'] = result.get('id') 250 gpa = result.get('GPA').replace(',','.') 251 d['gpa'] = float(gpa) 252 ct.getContent().edit(mapping = d) 253 if tr_count > MAX_TRANS: 254 transaction.commit() 255 tr_count = 0 256 tr_count += 1 257 return self.students.academics_contents() 222 258 223 224 225 259 ###) 260 261 226 262 security.declareProtected(View,"Title") 227 263 def Title(self): -
WAeUP_SRP/trunk/profiles/default/layouts.xml
r362 r398 13 13 <object name="clearence" meta_type="CPS Layout"/> 14 14 <object name="course" meta_type="CPS Layout"/> 15 <object name="course_results" meta_type="CPS Layout"/> 15 16 <object name="department" meta_type="CPS Layout"/> 16 17 <object name="faculty" meta_type="CPS Layout"/> -
WAeUP_SRP/trunk/profiles/default/schemas/course_results.xml
r199 r398 1 1 <?xml version="1.0"?> 2 2 <object name="course_results" meta_type="CPS Schema"> 3 <field name="ansbook" meta_type="CPS String Field"/> 4 <field name="carry_level" meta_type="CPS String Field"/> 5 <field name="gpa" meta_type="CPS Float Field"/> 3 6 <field name="grade" meta_type="CPS String Field"/> 4 <field name="points" meta_type="CPS Int Field"/> 7 <field name="import_id" meta_type="CPS String Field"/> 8 <field name="score" meta_type="CPS Int Field"/> 9 <field name="status" meta_type="CPS String Field"/> 10 <field name="verdict" meta_type="CPS String Field"/> 11 <field name="weight" meta_type="CPS String Field"/> 5 12 </object> -
WAeUP_SRP/trunk/profiles/default/types/StudentsFolder.xml
r364 r398 8 8 <property name="product">WAeUP_SRP</property> 9 9 <property name="factory">addStudentsFolder</property> 10 <property name="immediate_view"> folder_view</property>10 <property name="immediate_view">academics_contents</property> 11 11 <property name="global_allow">True</property> 12 12 <property name="filter_content_types">True</property> … … 70 70 url_expr="string:${object_url}/loadFullTimeStudentsFromCSV" 71 71 visible="True"/> 72 <action title="Import FtS Results" action_id="import_fulltime_students" 73 category="import" condition_expr="" 74 url_expr="string:${object_url}/loadFullTimeStudentsResultsFromCSV" 75 visible="True"/> 72 76 </object>
Note: See TracChangeset for help on using the changeset viewer.