Changeset 14707


Ignore:
Timestamp:
28 Jun 2017, 05:28:54 (7 years ago)
Author:
Henrik Bettermann
Message:

Apply filter also to CustomExportPDFScoresSlip.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r14704 r14707  
    826826        except KeyError:
    827827            return []
    828         coursetickets_list = [
    829             i for i in coursetickets
    830             if i.student.current_mode in score_editing_enabled]
     828        coursetickets_list = [courseticket for courseticket in coursetickets
     829            if courseticket.student.current_mode in score_editing_enabled]
    831830        return coursetickets_list
    832831
     
    955954            code=(self.context.code, self.context.code)
    956955            )
     956        # Apply filter
     957        try:
     958            score_editing_enabled = grok.getSite()[
     959                'configuration'][str(session)].score_editing_enabled
     960            coursetickets_filtered = [courseticket
     961                for courseticket in coursetickets
     962                if courseticket.student.current_mode in score_editing_enabled]
     963        except KeyError:
     964            coursetickets_filtered = coursetickets
    957965        # In AAUE only editable tickets can be printed
    958966        editable_tickets = [
    959             ticket for ticket in coursetickets if ticket.editable_by_lecturer]
     967            ticket for ticket in coursetickets_filtered
     968            if ticket.editable_by_lecturer]
    960969        header = [[_(''),
    961970                   _('Matric No.'),
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r14701 r14707  
    430430        self.browser.open(self.edit_scores_url)
    431431        self.assertTrue('No student found' in self.browser.contents)
     432        pdf_url = '%s/coursetickets.pdf' % self.course_url
     433        self.browser.open(pdf_url)
     434        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     435        self.assertEqual(
     436            self.browser.headers['Content-Type'], 'application/pdf')
     437        path = os.path.join(samples_dir(), 'coursetickets_filtered.pdf')
     438        open(path, 'wb').write(self.browser.contents)
     439        print "Sample PDF coursetickets_filtered.pdf written to %s" % path
    432440        self.app['configuration']['2004'].score_editing_enabled = ['ug_ft']
    433441        self.browser.open(self.edit_scores_url)
Note: See TracChangeset for help on using the changeset viewer.