Ignore:
Timestamp:
26 Feb 2007, 16:00:26 (18 years ago)
Author:
joachim
Message:

create level respects now passmark if present
reindexCoursesCatalog must be run first, done on uniben-demo

File:
1 edited

Legend:

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

    r1495 r1498  
    1414from Products.AdvancedQuery import Eq, Between, Le,In
    1515aq_portal = context.portal_catalog.evalAdvancedQuery
     16aq_courses = context.courses_catalog.evalAdvancedQuery
    1617
    1718current = DateTime.DateTime()
     
    2122redirect = response.redirect
    2223logger = logging.getLogger('Student.create_level')
    23 students = context.portal_directories.students
    2424mtool = context.portal_membership
    2525member = mtool.getAuthenticatedMember()
     
    4949results = context.results_import(matric_no = student.matric_no)
    5050if results:
    51     carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
    52     #carry_overs = [brain for brain in results if int(brain.Score) < 40 ]
     51    #carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
    5352    l = []
     53    carry_overs = results
    5454    for co in carry_overs:
     55        carry_over = False
     56        query = Eq('code',co.CosCode)
     57        c_res = aq_courses(query)
     58        if not c_res:
     59            logger.info('"%s","%s course not found in courses catalog"' % (student.id,co.CosCode))
     60            continue
     61        course_cat_entry = c_res[0]
     62        if not course_cat_entry.passmark:
     63            carry_over = co.GRADE in ('D','E','F')
     64        else:
     65            try:
     66                score = int(co.Score)
     67            except:
     68                logger.info('"%s"," course %s invalid score %s"' % (student.id,
     69                                                                    co.CosCode,
     70                                                                    co.Score))
     71                continue
     72            if int(c_res[0].passmark) <= score: 
     73                continue
     74            carry_over = True
     75        if not carry_over:
     76            continue
    5577        d = context.getCourseInfo(co.CosCode)
    5678        d['grade'] = co.GRADE
     
    7799        course_result.getContent().edit(mapping=d)
    78100session.set('in_progress','finished')
     101return
    79102return response.redirect("%s" % level.absolute_url())
Note: See TracChangeset for help on using the changeset viewer.