Changeset 1391


Ignore:
Timestamp:
5 Feb 2007, 09:17:07 (18 years ago)
Author:
Henrik Bettermann
Message:

siehe Emails

Location:
WAeUP_SRP/trunk/skins/waeup_utilities
Files:
2 edited

Legend:

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

    r1388 r1391  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=REQUEST
     7##parameters=
    88##title=
    99##
     
    1313"""
    1414
    15 request = REQUEST
    1615request = context.REQUEST
    1716session = request.SESSION
    1817response = request.RESPONSE
    19 def rwrite(s):
    20     response.setHeader('Content-type','text/html; charset=ISO-8859-15')
    21     #response.setHeader('Content-length','%d' % (len(s)))
    22     #response.setStatus('OK')
    23     response.write(s)
     18setheader = request.RESPONSE.setHeader
     19
     20#def rwrite(s):
     21#    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
     22#    response.write(s)
     23   
    2424wftool = context.portal_workflow
    2525mtool = context.portal_membership
     
    3333students = context.portal_url.getPortalObject().campus.students
    3434
     35
     36
     37
    3538if str(member) not in ('admin','joachim'):
    36     return 
     39    return
    3740count = 0
    3841lc = 1
     42lines = []
    3943#from Products.zdb import set_trace;set_trace()
    4044res = scat()
    4145for sbrain in res:
    42     ec = "nor"
     46    if str(sbrain.level) == '100':
     47        ec = "new"
     48    else:
     49        ec = "nor"
    4350    erg = context.results_import(matric_no=sbrain.matric_no)
    4451    if erg and erg[0].Level:
     
    4855            ec = "E"
    4956            if level != e.Level:
    50                 ec = "%s:%s!=%s<br />\n" % (sbrain.matric_no,level,e.Level) 
     57                ec = "%s:%s!=%s<br />\n" % (sbrain.matric_no,level,e.Level)
    5158        level = "%d" % (int(level) + 100)
    52        
     59
    5360        # würde ich an dieser Stelle nicht machen (siehe unten)
    54         #context.students_catalog.modifyRecord(id = sbrain.id, level=level) 
    55        
     61        #context.students_catalog.modifyRecord(id = sbrain.id, level=level)
     62
    5663        while True:
    5764            student = getattr(students,sbrain.id,None)
     
    6370            if study_course is None:
    6471                break
    65             study_course.getContent().edit(mapping = {'current_level':level})
    66            
     72            # zum Testen auskommentiert   
     73            #study_course.getContent().edit(mapping = {'current_level':level})
     74
    6775            #dies ist der richtige Platz
    68             context.students_catalog.modifyRecord(id = sbrain.id, level=level) 
    69            
     76            context.students_catalog.modifyRecord(id = sbrain.id, level=level)
     77
    7078            ec = "reg"
    7179            break
     
    7482        else:
    7583            old_level = 'non'
    76         rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no +"--"+ old_level +"--"+ level +"<br />")
     84#        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no +"--"+ old_level +"--"+ level +"<br />")
     85
     86        lines.append('"%s","%s","%s","%s","%s"' % (ec,sbrain.id,sbrain.matric_no,old_level,level))
    7787       
     88
    7889    else:
    79         rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no + "<br />")
     90#        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no + "<br />")
     91        lines.append('"%s","%s","%s","",""' % (ec,sbrain.id,sbrain.matric_no))
     92       
    8093#    count += 1
    8194#    if count > 60:
     
    8396#        rwrite("<br />\n%3d " % lc)
    8497#        count = 0
    85 rwrite("<br />\n Done" )
    8698
     99#rwrite("<br />\n Done" )
     100
     101setheader('Content-type','text/semicolon-seperated-values')
     102setheader('Content-Disposition:', 'attachment; filename="fixLevelExport.csv"')
     103setheader('Expires',  'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past
     104setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1
     105setheader('Cache-Control', 'post-check=0,pre-check=0')
     106setheader('Pragma', 'no-cache') # HTTP/1.0
     107return '\n'.join(lines)
     108
  • WAeUP_SRP/trunk/skins/waeup_utilities/removeResults.py

    r1388 r1391  
    2222    response.write(s)
    2323
     24res_to_del = ('ART0206832',
     25    'ART0206156',
     26    'ART0206812',
     27    'ART0206841',
     28    'ART0206813',
     29    'ART0206816',
     30    'ART0206614',
     31    'ART0206817',
     32    'ART0206830',
     33    'ART0205970',
     34    'ART0206158',
     35    'ART0206811',
     36    'ART0206815',
     37    'ART0301351',
     38    'ART0301319',
     39    'ART0301310',
     40    'ART0308340',
     41    'ART0206157',
     42    'ART0206833',
     43    'ART0206831',
     44    'ART0206964',
     45    'ART0206838',
     46    'ART0206821',
     47    'ART0206844',
     48    'ART0206828',
     49    'ART0206820',
     50    'ART0206842',
     51    'ART0206834',
     52    'ART0206839',
     53    'ART0206819',
     54    'ART0206825',
     55    'ART0206818',
     56    'ART0206840',
     57    'ART0206836',
     58    'ART0206829')
     59
     60
    2461wftool = context.portal_workflow
    2562mtool = context.portal_membership
     
    3168if str(member) not in ('admin','joachim'):
    3269    return
    33 rwrite("start <br />")
    34 for m in rcat.uniqueValuesFor('matric_no'):
     70rwrite("start")
     71#for m in rcat.uniqueValuesFor('matric_no'):
     72for m in res_to_del:
    3573    #if m.startswith('ART'):
    3674    res_r = rcat(matric_no = m)
    37     res_s = scat(matric_no = m)
    38     if res_s and res_s[0].course == 'BARTTHR' and res_s[0].level =="500":
    39         to_del = []
    40         for r in res_r:
    41             to_del.append(r.key)
    42            
    43         #zum Testen auskommentiert   
    44         #for uid in to_del:
    45             #rcat.deleteRecord(uid)
    46            
    47         rwrite(m+" "+res_s[0].course+" "+res_s[0].level + " " + str(len(to_del)) +"<br />")
    48 rwrite("<br />\n Done" )       
     75    #res_s = scat(matric_no = m)
     76    #if res_s and res_s[0].course == 'BARTTHR' and res_s[0].level =="500":
     77    to_del = []
     78    for r in res_r:
     79        to_del.append(r.key)
     80        rwrite(m+" "+r.Level +"  " + r.CosCode + "<br />")
     81    #for uid in to_del:
     82        #rcat.deleteRecord(uid)
     83rwrite("Done")
     84
Note: See TracChangeset for help on using the changeset viewer.