Ignore:
Timestamp:
29 Aug 2013, 15:12:04 (11 years ago)
Author:
Henrik Bettermann
Message:

Define _set_faccode_depcode_values method properly.

Tests will follow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/level_report.py

    r10560 r10562  
    158158    def generate(self, site, faccode=None, depcode=None,
    159159                 session=None, level=None, author=None):
    160         result = LevelReportReport(faccode=faccode, depcode=depcode,
    161                                    session=session, level=level, author=author)
     160        result = LevelReport(faccode=faccode, depcode=depcode,
     161                             session=session, level=level, author=author)
    162162        return result
    163163
     
    192192        self._set_level_values()
    193193        self._set_faccode_depcode_values()
    194         #faccode = faccode_depcode.split('_')[0]
    195         #depcode = faccode_depcode.split('_')[1]
    196194        if CREATE and session:
    197195            # create a new report job for students by session
     196            faccode = faccode_depcode.split('_')[0]
     197            depcode = faccode_depcode.split('_')[1]
    198198            container = self.context.__parent__
    199199            user_id = self.request.principal.id
     
    208208            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    209209            grok.getSite().logger.info(
    210                 '%s - report %s created: %s (session=%s, mode=%s)' % (
    211                 ob_class, job_id, self.context.title, session, mode))
     210                '%s - report %s created: %s (faculty=%s, department=%s, session=%s, level=%s)' % (
     211                ob_class, job_id, self.context.title, faccode, depcode, session, level))
    212212            self.redirect(self.parent_url)
    213213            return
     
    225225
    226226    def _set_faccode_depcode_values(self):
    227         # Not yet implemented
    228         self.faccode_depcodes = None
    229         return
    230 
     227        faccode_depcodes = []
     228        faculties = grok.getSite()['faculties']
     229        for fac in faculties.values():
     230            for dep in fac.values():
     231                faccode_depcodes.append(
     232                    ('%s (%s)' %(dep.longtitle(), fac.longtitle()),
     233                     '%s_%s' %(fac.code, dep.code)))
     234        self.faccode_depcodes = sorted(
     235            faccode_depcodes, key=lambda value: value[0])
     236        return
    231237
    232238class LevelReportPDFView(grok.View):
     
    237243
    238244    def render(self):
    239         filename = 'LevelReport_%s_%s_%s.pdf' % (
    240             self.context.session, self.context.mode,
     245        filename = 'LevelReport_%s_%s_%s_%s_%s.pdf' % (
     246            self.context.faccode, self.context.depcode,
     247            self.context.sessioncode, self.context.levelcode,
    241248            self.context.creation_dt_string)
    242249        filename = filename.replace(
Note: See TracChangeset for help on using the changeset viewer.