Ignore:
Timestamp:
9 Feb 2012, 08:04:54 (13 years ago)
Author:
Henrik Bettermann
Message:

Fix getTitle method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py

    r7611 r7617  
    6363    def getTitle(self, context, value):
    6464        if context.certificate is not None:
     65            start_level = int(context.certificate.start_level)
    6566            end_level = int(context.certificate.end_level)
    6667        else:
     68            start_level = 10
    6769            end_level = 800
     70        if value < start_level or value > end_level + 110:
     71            return "Error: level id %s out of range" % value
     72        if value == 10:
     73            return course_levels.by_value[value].title
    6874        level,repeat = divmod(value, 100)
    6975        level = level * 100
     
    7177        title = course_levels.by_value[level].title
    7278        if level > end_level and repeat:
    73             title = course_levels.by_value[level-100].title
    74             title = "%s 2nd spillover" % title
    75         elif level > end_level:
    76             title = course_levels.by_value[level-100].title
    77             title = "%s spillover" % title
    78         elif repeat:
    79             title = "%s on %d. probation" % (title, repeat)
     79            title = course_levels.by_value[level - 100].title
     80            return "%s 2nd spillover" % title
     81        if level > end_level:
     82            title = course_levels.by_value[level - 100].title
     83            return "%s spillover" % title
     84        if repeat:
     85            return "%s on %d. probation" % (title, repeat)
    8086        return title
    8187
Note: See TracChangeset for help on using the changeset viewer.