Changeset 1284 for WAeUP_SRP


Ignore:
Timestamp:
12 Jan 2007, 15:58:42 (18 years ago)
Author:
joachim
Message:

take start_level from certificate for new students

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_utilities/fixLevel.py

    r1254 r1284  
    3636modified.append("%d to change" % len(res))
    3737list = []
     38dbrains = {}
    3839for sbrain in res:
    39     list.append((sbrain.id,sbrain.matric_no))
    40 for id,m in list:
     40    list.append((sbrain.id,sbrain.matric_no,sbrain.course))
     41for id,m,c in list:
    4142    erg = context.results_import(matric_no=m)
    4243    if erg and erg[0].Level:
     
    4445        modified.append("%s, %s" % (id,m))
    4546    else:
    46         modified.append("no results for %s, %s" % (id,m))
     47        pres = context.portal_catalog(id=sbrain.id)
     48        if not pres:
     49            modified.append("no results for %s, %s" % (id,m))
     50            continue
     51        review_state = pres[0].review_state
     52        if review_state not in ('admitted',
     53                                'clearance_pin_entered',
     54                                'clearance_requested',
     55                                'cleared_and_validated',
     56                                ):
     57            modified.append("no new student %s" % (id))
     58            continue
     59        cres = context.portal_catalog(id = c)
     60        if not cres:
     61            modified.append("no certificate %s for %s" % (id,c))
     62        cert_doc = cres[0].getObject().getContent()
     63        level = getattr(cert_doc,'start_level',None)
     64        if level is None:
     65            modified.append("no start_level in certificate %s for %s" % (id,c))
     66        context.students_catalog.modifyRecord(id=id, level=level)
     67        modified.append("%s, %s" % (id,c))
     68       
    4769return '\n'.join(modified)
Note: See TracChangeset for help on using the changeset viewer.