Changeset 1873


Ignore:
Timestamp:
8 Jun 2007, 19:53:48 (18 years ago)
Author:
joachim
Message:

fix for #255

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/refresh_level.py

    r1845 r1873  
    5656level = context
    5757#results = context.results_import(matric_no = student.matric_no)
    58 results = False #skip carry overs
    59 if results:
    60     #carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
    61     l = []
    62     carry_overs = results
    63     for co in carry_overs:
    64         carry_over = False
    65         query = Eq('code',co.CosCode)
    66         c_res = aq_courses(query)
    67         if not c_res:
    68             logger.info('%s, course %s not found in courses_catalog' % (student.id,co.CosCode))
    69             continue
    70         course_cat_entry = c_res[0]
    71         if not course_cat_entry.passmark:
    72             carry_over = co.GRADE in ('D','E','F')
    73         else:
    74             try:
    75                 score = int(co.Score)
    76             except:
    77                 logger.info('%s, course %s has invalid score %s' % (student.id,
    78                                                                     co.CosCode,
    79                                                                     co.Score))
    80                 continue
    81             if int(c_res[0].passmark) <= score:
    82                 continue
    83             carry_over = True
    84         if not carry_over:
    85             continue
    86         d = context.getCourseInfo(co.CosCode)
    87         d['grade'] = co.GRADE
    88         d['carry_level'] = co.CarryLevel
    89         course_id = "%s_co" % co.CosCode
    90         if not context.hasObject(course_id):
    91             cr_id = level.invokeFactory('StudentCourseResult',course_id)
    92             course_result = getattr(level,cr_id)
    93             context.portal_workflow.doActionFor(course_result,'open')
    94             course_result.getContent().edit(mapping=d)
     58# results = False #skip carry overs
     59# if results:
     60#     #carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
     61#     l = []
     62#     carry_overs = results
     63#     for co in carry_overs:
     64#         carry_over = False
     65#         query = Eq('code',co.CosCode)
     66#         c_res = aq_courses(query)
     67#         if not c_res:
     68#             logger.info('%s, course %s not found in courses_catalog' % (student.id,co.CosCode))
     69#             continue
     70#         course_cat_entry = c_res[0]
     71#         if not course_cat_entry.passmark:
     72#             carry_over = co.GRADE in ('D','E','F')
     73#         else:
     74#             try:
     75#                 score = int(co.Score)
     76#             except:
     77#                 logger.info('%s, course %s has invalid score %s' % (student.id,
     78#                                                                     co.CosCode,
     79#                                                                     co.Score))
     80#                 continue
     81#             if int(c_res[0].passmark) <= score:
     82#                 continue
     83#             carry_over = True
     84#         if not carry_over:
     85#             continue
     86#         d = context.getCourseInfo(co.CosCode)
     87#         d['grade'] = co.GRADE
     88#         d['carry_level'] = co.CarryLevel
     89#         course_id = "%s_co" % co.CosCode
     90#         if not context.hasObject(course_id):
     91#             cr_id = level.invokeFactory('StudentCourseResult',course_id)
     92#             course_result = getattr(level,cr_id)
     93#             context.portal_workflow.doActionFor(course_result,'open')
     94#             course_result.getContent().edit(mapping=d)
    9595res = context.portal_catalog(portal_type="Certificate", id = cert_id)
    9696l = []
     
    110110            d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
    111111            course_result.getContent().edit(mapping=d)
     112            context.waeup_tool.doCommit()
    112113#session.set('in_progress','finished')
    113114logger.info('%s updated course list' % member)
Note: See TracChangeset for help on using the changeset viewer.