Changeset 2040


Ignore:
Timestamp:
20 Jul 2007, 11:05:34 (17 years ago)
Author:
joachim
Message:

don't add existing course

File:
1 edited

Legend:

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

    r1873 r2040  
    4343cert_id = student.course
    4444current_level = student.level
    45 ##in_progress =  session.get('in_progress','finished')
    46 ##if in_progress == 'finished':
    47 ##    session.set('in_progress','started')
    48 ##    view = context.in_progress_view(refresh=3,page=action_after_validate)
    49 ##    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
    50 ##    response.setHeader('Content-length','%d' % (len(view)))
    51 ##    response.setStatus('OK')
    52 ##    response.write(view)
    53 ##    response.write('')
    54 ##elif in_progress == 'started':
    55 ##    return
    5645level = context
    5746#results = context.results_import(matric_no = student.matric_no)
     
    10190            Eq('portal_type','CertificateCourse')
    10291    courses = aq_portal(query)
    103     for c in courses:
     92    course_ids = [c.getId  for c in courses if c.getId not in level.objectIds()]
     93    for c_id in course_ids:
    10494        #set_trace()
    105         if not context.hasObject(c.getId):
    106             d = context.getCourseInfo(c.getId)
    107             cr_id = level.invokeFactory('StudentCourseResult',c.getId)
    108             course_result = getattr(level,cr_id)
    109             context.portal_workflow.doActionFor(course_result,'open')
    110             d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
    111             course_result.getContent().edit(mapping=d)
    112             context.waeup_tool.doCommit()
     95        d = context.getCourseInfo(c_id)
     96        cr_id = level.invokeFactory('StudentCourseResult',c_id)
     97        course_result = getattr(level,cr_id)
     98        context.portal_workflow.doActionFor(course_result,'open')
     99        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
     100        course_result.getContent().edit(mapping=d)
     101        context.waeup_tool.doCommit()
    113102#session.set('in_progress','finished')
    114103logger.info('%s updated course list' % member)
Note: See TracChangeset for help on using the changeset viewer.