Changeset 2766
- Timestamp:
- 26 Nov 2007, 19:18:09 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTables.py
r2761 r2766 536 536 raise ValueError("More than one record with uid %s" % uid) 537 537 if len(records) == 0: 538 return -1 538 return -1,None 539 539 record = records[0] 540 540 if record.student == "": … … 546 546 try: 547 547 self.catalog_object(dict2ob(record_data), uid) 548 return 1 548 return 1,record 549 549 except ConflictError: 550 return 2 550 return 2,record 551 551 if record.student.upper() != student_id.upper(): 552 return 0 552 return 0,record 553 553 if record.student.upper() == student_id.upper(): 554 return 2 555 return -3 554 return 2,record 555 return -3,record 556 556 InitializeClass(PinTable) 557 557 ###) -
WAeUP_SRP/base/WAeUPTool.py
r2755 r2766 1445 1445 if course_id not in self._v_courses.keys(): 1446 1446 return '', "No course with ID: %s" % course_id 1447 id_key = '' 1448 for id_key in ('student_id','matric_no'): 1449 id_field = mapping.get(id_key,None) 1450 if id_field is not None: 1451 student_id = id_field 1452 break 1453 query = Eq(id_key,id_field) 1454 res = self.students_catalog.evalAdvancedQuery(query) 1455 if not res: 1447 # id_key = '' 1448 # for id_key in ('student_id','matric_no'): 1449 # id_field = mapping.get(id_key,None) 1450 # if id_field is not None: 1451 # student_id = id_field 1452 # break 1453 # query = Eq(id_key,id_field) 1454 # res = self.students_catalog.evalAdvancedQuery(query) 1455 student_rec = self.students_catalog.getRecordByKey(mapping['student_id']) 1456 if student_rec is None: 1456 1457 return '', "no student with %(id_key)s %(id_field)s" % vars() 1457 if id_field != "student_id": 1458 mapping['student_id'] = res[0].id 1458 # if id_field != "student_id": 1459 # mapping['student_id'] = res[0].id 1460 student_id = student_rec.id 1461 level_id = mapping['level_id'] 1462 code = mapping['code'] 1459 1463 if mapping['student_id'] not in self._v_level_created: 1460 1464 try: 1461 1465 context = getattr(getattr(students_folder, 1462 "%(student_id)s" % mapping),1466 "%(student_id)s" % vars()), 1463 1467 'study_course') 1464 1468 except: 1465 return '', "could not create level %(level_id)s for %(student_id)s" % mapping1466 if mapping['level_id']not in context.objectIds():1467 context.invokeFactory('StudentStudyLevel',"%(level_id)s" % mapping)1468 level = getattr(context,"%(level_id)s" % mapping)1469 return '', "could not create level %(level_id)s for %(student_id)s" % vars() 1470 if level_id not in context.objectIds(): 1471 context.invokeFactory('StudentStudyLevel',"%(level_id)s" % vars()) 1472 level = getattr(context,"%(level_id)s" % vars()) 1469 1473 self.portal_workflow.doActionFor(level,'open') 1470 1471 1474 # the session string must not be copied into the level object 1472 #level.getContent().edit(mapping={'session': "%(session_id)s" % mapping}) 1473 1474 #self.portal_workflow.doActionFor(level,'close_for_edit') 1475 self._v_level_created += mapping['student_id'], 1476 mapping['key'] = key = "%(student_id)s|%(level_id)s|%(code)s" % mapping 1475 if student_rec.current_verdict: 1476 level.getContent().edit(mapping={'verdict': "%s" % 1477 student_rec.current_verdict, 1478 'session': "%s" % 1479 student_rec.current_session, 1480 }) 1481 self.portal_workflow.doActionFor(level,'close') 1482 self._v_level_created += student_id, 1483 mapping['key'] = key = "%(student_id)s|%(level_id)s|%(code)s" % vars() 1477 1484 for k in ('semester','credits',): 1478 1485 mapping[k] = getattr(self._v_courses[course_id],k) … … 1495 1502 # if course_id not in self._v_courses.keys(): 1496 1503 # return '', "No course with ID: %s" % did 1497 id_key = '' 1498 for id_key in ('student_id','matric_no'): 1499 id_field = mapping.get(id_key,None) 1500 if id_field is not None: 1501 student_id = id_field 1502 break 1503 query = Eq(id_key,id_field) 1504 res = self.students_catalog.evalAdvancedQuery(query) 1505 if not res: 1506 return '', "No student with %(id_field)s: %(id_key)s" % vars() 1507 if id_field != "student_id": 1508 mapping['student_id'] = res[0].id 1509 mapping['key'] = key = "%(student_id)s|%(level_id)s|%(code)s" % mapping 1504 # id_key = '' 1505 # for id_key in ('student_id','matric_no'): 1506 # id_field = mapping.get(id_key,None) 1507 # if id_field is not None: 1508 # student_id = id_field 1509 # break 1510 # query = Eq(id_key,id_field) 1511 # res = self.students_catalog.evalAdvancedQuery(query) 1512 # if not res: 1513 # return '', "No student with %(id_field)s: %(id_key)s" % vars() 1514 # if id_field != "student_id": 1515 # mapping['student_id'] = res[0].id 1516 students_folder = self.portal_url.getPortalObject().campus.students 1517 student_rec = self.students_catalog.getRecordByKey(mapping['student_id']) 1518 if student_rec is None: 1519 return '', "no student with %(id_key)s %(id_field)s" % vars() 1520 student_id = student_rec.id 1521 level_id = mapping['level_id'] 1522 code = mapping['code'] 1523 mapping['key'] = key = "%(student_id)s|%(level_id)s|%(code)s" % vars() 1510 1524 # for k in ('semester',): 1511 1525 # mapping[k] = getattr(self._v_courses[course_id],k) … … 1514 1528 except KeyError: 1515 1529 return '', "No course result to edit: %s" % key 1530 if student_rec.current_verdict: 1531 #makes only sense if the course_results are imported for the current session 1532 try: 1533 level = getattr(getattr(getattr(students_folder, 1534 "%(student_id)s" % vars()), 1535 'study_course'), 1536 "%(level_id)s" % vars()) 1537 except: 1538 return '', "could not find level %(level_id)s for %(student_id)s" % vars() 1539 if self.portal_workflow.getInfoFor(level,'review_state',None) == "closed": 1540 self.portal_workflow.doActionFor(level,'open') 1541 level.getContent().edit(mapping={'verdict': "%s" % 1542 student_rec.current_verdict, 1543 'session': "%s" % 1544 student_rec.current_session, 1545 }) 1546 self.portal_workflow.doActionFor(level,'close') 1516 1547 return key,'' 1517 1548 ###) -
WAeUP_SRP/base/Widgets.py
r2738 r2766 24 24 #from Products.ExtFile.ExtFile import ExtFile 25 25 import logging,os,re 26 import random 26 27 import operator 27 28 p_home = Globals.package_home(globals()) … … 31 32 32 33 33 class WAeUPPasswordWidget(CPSPasswordWidget): 34 class WAeUPPasswordWidget(CPSPasswordWidget): ###( 34 35 """WAeUP Password Widget""" 35 36 meta_type = 'WAeUP Password Widget' … … 117 118 118 119 widgetRegistry.register(WAeUPPasswordWidget) 119 120 ###) 120 121 121 122 class CPSSelectWidgetForRecord(CPSSelectWidget): ###( … … 1320 1321 1321 1322 while do: 1322 ok = pins.searchAndSetRecord(pin,ref,prefix)1323 ok,record = pins.searchAndSetRecord(pin,ref,prefix) 1323 1324 if ok < -2 or ok > 2: 1324 1325 err = 'Unknown error, please report!' … … 1473 1474 def validate(self, datastructure, **kw): ###( 1474 1475 """Validate datastructure and update datamodel.""" 1475 #import pdb;pdb.set_trace()1476 1476 s_logger = logging.getLogger('Widgets.ScratchcardPinWidget.validate') 1477 1477 widget_id = self.getWidgetId() … … 1519 1519 s_logger.info('%s/%s entered wrong data together with PIN %s' % (member_id,ref,pin_str)) 1520 1520 while do: 1521 ok = pins.searchAndSetRecord(pin,ref,prefix)1521 ok,pin_record = pins.searchAndSetRecord(pin,ref,prefix) 1522 1522 if ok < -2 or ok > 2: 1523 1523 err = 'Unknown error, please report!' … … 1556 1556 d['reg_no'] = applicant.reg_no 1557 1557 d['pin'] = pin_str 1558 d['serial'] = "%c%05d" % (pin_record.prefix_batch[-1], 1559 pin_record.serial) 1558 1560 #d['screening_type'] = screening_type 1559 1561 #d['status'] = 'entered' -
WAeUP_SRP/base/skins/waeup_pins/pins_view.pt
r2140 r2766 62 62 > 63 63 <option value="--">Goto Batch ...</option> 64 <option tal:repeat="batch context/objectIds"64 <option tal:repeat="batch info/batches" 65 65 tal:attributes="value batch" 66 66 tal:content="batch"> -
WAeUP_SRP/base/skins/waeup_pins/search_pins.py
r2615 r2766 109 109 view = context.batch_view 110 110 elif context.portal_type == "ScratchCardBatchesFolder": 111 batches = context.objectIds() 112 batches.sort() 113 info['batches'] = batches 111 114 view = context.pins_view 112 115 if psm == '': -
WAeUP_SRP/base/skins/waeup_student/create_level.py
r2758 r2766 39 39 lt = context.portal_layouts 40 40 wt = context.waeup_tool 41 student = context.students_catalog (id=student_id)[0]41 student = context.students_catalog.getRecordByKey(student_id) 42 42 cert_id = student.course 43 43 current_level = student.level … … 51 51 52 52 if context.hasObject(current_level): 53 level = getattr(context,"%s" % current_level) 53 #level = getattr(context,"%s" % current_level) 54 return response.redirect("%s/%s" % (context.absolute_url(),current_level)) 54 55 else: 55 56 context.invokeFactory('StudentStudyLevel',"%s" % current_level) … … 65 66 results = context.results_import(matric_no = student.matric_no) 66 67 l = [] 67 68 68 69 69 # fetch carry_over courses from results_import … … 110 110 records.append(d) 111 111 # fetch carry_over courses from the course_results catalog 112 # else 112 else: 113 res = context.aq_results(Eq('student_id',student_id), 114 sortSpecs=('level_id',)) 115 last_level_id = res[-1].level_id 116 for result in res: 117 course_id = result.code 118 if course_id in l or result.level_id != last_level_id: 119 continue 120 query = Eq('code',course_id) 121 c_res = aq_courses(query) 122 if not c_res: 123 #logger.info('%s", course %s not found in courses_catalog' % (student.id,result.CosCode)) 124 continue 125 course_cat_entry = c_res[0] 126 passmark = getattr(course_cat_entry,'passmark',None) 127 try: 128 score = int(result.score) 129 except: 130 # logger.info('%s, course %s has invalid score %s"' % (student.id, 131 # course_id, 132 # result.Score)) 133 continue 134 if int(c_res[0].passmark) <= score: 135 continue 136 l += course_id, 137 d = context.getCourseInfo(course_id) 138 d['course_id'] = course_id 139 d['carry_over'] = True 140 d['code'] = course_id 141 d['student_id'] = student_id 142 d['level_id'] = level_id 143 d['session_id'] = session_id 144 records.append(d) 113 145 114 146 # fetch session courses from the certificate -
WAeUP_SRP/uniben/profiles/default/applicants_catalog.xml
r2759 r2766 17 17 <column value="phone"/> 18 18 <column value="pin"/> 19 <column value="serial"/> 19 20 <column value="eng_score"/> 20 21 <column value="subj1"/> … … 59 60 <indexed_attr value="reg_no"/> 60 61 </index> 62 <index name="serial" meta_type="FieldIndex"> 63 <indexed_attr value="serial"/> 64 </index> 61 65 <index name="status" meta_type="FieldIndex"> 62 66 <indexed_attr value="status"/> -
WAeUP_SRP/uniben/profiles/default/layouts/application_cest.xml
r2763 r2766 815 815 </row> 816 816 <row> 817 <cell name="serial" ncols="2"/> 818 </row> 819 <row> 817 820 <cell name="firstname" ncols="2"/> 818 821 </row>
Note: See TracChangeset for help on using the changeset viewer.