Changeset 1391 for WAeUP_SRP/trunk/skins/waeup_utilities
- Timestamp:
- 5 Feb 2007, 09:17:07 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py
r1388 r1391 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= REQUEST7 ##parameters= 8 8 ##title= 9 9 ## … … 13 13 """ 14 14 15 request = REQUEST16 15 request = context.REQUEST 17 16 session = request.SESSION 18 17 response = 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) 18 setheader = request.RESPONSE.setHeader 19 20 #def rwrite(s): 21 # response.setHeader('Content-type','text/html; charset=ISO-8859-15') 22 # response.write(s) 23 24 24 wftool = context.portal_workflow 25 25 mtool = context.portal_membership … … 33 33 students = context.portal_url.getPortalObject().campus.students 34 34 35 36 37 35 38 if str(member) not in ('admin','joachim'): 36 return 39 return 37 40 count = 0 38 41 lc = 1 42 lines = [] 39 43 #from Products.zdb import set_trace;set_trace() 40 44 res = scat() 41 45 for sbrain in res: 42 ec = "nor" 46 if str(sbrain.level) == '100': 47 ec = "new" 48 else: 49 ec = "nor" 43 50 erg = context.results_import(matric_no=sbrain.matric_no) 44 51 if erg and erg[0].Level: … … 48 55 ec = "E" 49 56 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) 51 58 level = "%d" % (int(level) + 100) 52 59 53 60 # 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 56 63 while True: 57 64 student = getattr(students,sbrain.id,None) … … 63 70 if study_course is None: 64 71 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 67 75 #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 70 78 ec = "reg" 71 79 break … … 74 82 else: 75 83 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)) 77 87 88 78 89 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 80 93 # count += 1 81 94 # if count > 60: … … 83 96 # rwrite("<br />\n%3d " % lc) 84 97 # count = 0 85 rwrite("<br />\n Done" )86 98 99 #rwrite("<br />\n Done" ) 100 101 setheader('Content-type','text/semicolon-seperated-values') 102 setheader('Content-Disposition:', 'attachment; filename="fixLevelExport.csv"') 103 setheader('Expires', 'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past 104 setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1 105 setheader('Cache-Control', 'post-check=0,pre-check=0') 106 setheader('Pragma', 'no-cache') # HTTP/1.0 107 return '\n'.join(lines) 108 -
WAeUP_SRP/trunk/skins/waeup_utilities/removeResults.py
r1388 r1391 22 22 response.write(s) 23 23 24 res_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 24 61 wftool = context.portal_workflow 25 62 mtool = context.portal_membership … … 31 68 if str(member) not in ('admin','joachim'): 32 69 return 33 rwrite("start <br />") 34 for m in rcat.uniqueValuesFor('matric_no'): 70 rwrite("start") 71 #for m in rcat.uniqueValuesFor('matric_no'): 72 for m in res_to_del: 35 73 #if m.startswith('ART'): 36 74 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) 83 rwrite("Done") 84
Note: See TracChangeset for help on using the changeset viewer.