Ignore:
Timestamp:
16 Apr 2020, 16:17:39 (5 years ago)
Author:
Henrik Bettermann
Message:

Sort certificates.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser.py

    r16053 r16054  
    183183    """
    184184
    185     @property
    186     def display_refereereports(self):
    187         if self.context.refereereports:
    188             return True
    189         return False
    190 
    191185    def display_fileupload(self, filename):
    192186        if filename[1] == 'res_stat.pdf':
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/utils.py

    r16052 r16054  
    7575        }
    7676
     77    def sortCertificates(self, context, resultset):
     78        """Sort already filtered certificates in `AppCatCertificateSource`.
     79        """
     80        resultlist = sorted(resultset, key=lambda
     81            value: value.__parent__.__parent__.__parent__.code +
     82            value.__parent__.__parent__.code +
     83            value.code)
     84        curr_course = context.course1
     85        if curr_course is not None and curr_course not in resultlist:
     86            resultlist = [curr_course,] + resultlist
     87        return resultlist
     88
    7789    def getCertTitle(self, context, value):
    7890        """Compose the titles in `AppCatCertificateSource`.
    7991        """
    80         return "%s (%s)" % (value.title, value.code)
     92        try: title = "%s / %s / %s (%s)" % (
     93            value.__parent__.__parent__.__parent__.code,
     94            value.__parent__.__parent__.code,
     95            value.title, value.code)
     96        except AttributeError:
     97            title = "NA / %s (%s)" % (value.title, value.code)
     98        return title
Note: See TracChangeset for help on using the changeset viewer.