Changeset 2641 for WAeUP_SRP/base


Ignore:
Timestamp:
13 Nov 2007, 14:07:36 (17 years ago)
Author:
joachim
Message:

belongs to previous fix for #207

File:
1 copied

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_student/getStudentLevelsVoc.py

    r2637 r2641  
    1010        pass
    1111"""
     12student_id = context.getStudentId()
     13if student_id:
     14    end_level = int(context.students_catalog(id = student_id)[0].end_level)
     15else:
     16    end_level = 600
    1217
    1318if key is None:
    14     return [("%s" % l,"Level %s" % l) for l in range(100,700,100)]
     19    levels = [l for l in range(100,end_level+200,10)
     20               if l % 100 < 30 and l < end_level + 110]
     21    voc = []
     22    for l in levels:
     23        level_nr,repeat = divmod(l, 100)
     24        if level_nr > end_level/100:
     25            voc += ("%s" % l,"%s (spillover)" % context.portal_vocabularies.levels.get("%d00" % (level_nr - 1))),
     26        elif repeat > 0:
     27            voc += ("%s" % l,"%s (on %d. probation)" %
     28                    (context.portal_vocabularies.levels.get("%d00" % (level_nr)),
     29                                                            (repeat // 10))),
     30        else:
     31            voc += ("%s" % l,"%s" %
     32                    (context.portal_vocabularies.levels.get("%d00" % (level_nr)))),
     33    return voc
     34       
    1535ikey = int(key)
    1636level_nr,repeat = divmod(ikey, 100)
    1737l = []
    18 student = context.students_catalog(id = context.getStudentId())[0]
    1938
    2039level = context.portal_vocabularies.levels.get("%d00" % level_nr)
    21 if level_nr > int(student.end_level)/100:
     40if level_nr > end_level/100:
    2241    return "%s (spillover)" % context.portal_vocabularies.levels.get("%d00" % (level_nr - 1))
    2342
Note: See TracChangeset for help on using the changeset viewer.