Ignore:
Timestamp:
8 Feb 2007, 18:08:38 (18 years ago)
Author:
joachim
Message:

fix the levels
add verdict to students_catalog
add current_verdict to student_study_course
add the same fixes to makeStudentData (not yet tested)

File:
1 edited

Legend:

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

    r1392 r1401  
    3434
    3535
    36 
    37 
    3836if str(member) not in ('admin','joachim'):
    3937    return
    4038count = 0
    41 lc = 1
     39line_count = 0
    4240lines = []
    4341#from Products.zdb import set_trace;set_trace()
    4442res = scat()
    4543for sbrain in res:
    46 
    4744    old_level = str(sbrain.level)
    48  
    4945    if str(sbrain.level) == '100':
    5046        ec = "new"
     
    5248        ec = "nor"
    5349    erg = context.results_import(matric_no=sbrain.matric_no)
     50    lc = 'u'
    5451    if erg and erg[0].Level:
    55         ec = "e"
     52        lc = "e" # code for level status u = unset
    5653        level = erg[0].Level
    57         for e in erg:
    58             ec = "E"
    59             if level != e.Level:
    60                 ec = "%s:%s!=%s<br />\n" % (sbrain.matric_no,level,e.Level)
    61         level = "%d" % (int(level) + 100)
    62 
    63         context.students_catalog.modifyRecord(id = sbrain.id, level="")
    64 
     54        everdict = erg[0].Verdict
     55        lnr = context.getLevelFromResultsCosCode(erg)
     56        if lnr == 0:
     57            lc = "-"
     58        if "%d00" % lnr != level:
     59            lc = "!"
     60        verdict,elegible = context.getVerdict(everdict)
     61        if elegible:
     62            lc = "+"
     63            level = "%d00" % (lnr + 1)
     64        context.students_catalog.modifyRecord(id = sbrain.id,
     65                                              level="",
     66                                              verdict = "")
    6567        while True:
    6668            student = getattr(students,sbrain.id,None)
     
    7274            if study_course is None:
    7375                break
    74 
    75             study_course.getContent().edit(mapping = {'current_level':level})
    76             context.students_catalog.modifyRecord(id = sbrain.id, level=level)
    77 
     76            study_course.getContent().edit(mapping = {'current_level':level,
     77                                                      'current_verdict':verdict})
     78            context.students_catalog.modifyRecord(id = sbrain.id,
     79                                                  level=level,
     80                                                  verdict=verdict)
    7881            ec = "reg"
    7982            break
     
    8184#        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no +"--"+ old_level +"--"+ level +"<br />")
    8285
    83         lines.append('"%s","%s","%s","%s","%s"' % (ec,sbrain.id,sbrain.matric_no,old_level,level))
     86        lines.append('"%s %s","%s","%s","%s","%s","%s","%s"' % (lc,ec,
     87                                                           sbrain.id,
     88                                                           sbrain.matric_no,
     89                                                           old_level,
     90                                                           level,
     91                                                           everdict,
     92                                                           verdict))
    8493       
    8594
     
    9099#    count += 1
    91100#    if count > 60:
    92 #        lc += 1
    93 #        rwrite("<br />\n%3d " % lc)
     101#        line_count += 1
     102#        rwrite("<br />\n%3d " % line_count)
    94103#        count = 0
    95104
Note: See TracChangeset for help on using the changeset viewer.