Changeset 13484


Ignore:
Timestamp:
19 Nov 2015, 11:34:48 (9 years ago)
Author:
Henrik Bettermann
Message:

Add bed statistics view components.

Location:
main/waeup.kofa/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r13471 r13484  
    441.3.4.dev0 (unreleased)
    55=======================
     6
     7* Add bed statistics components.
    68
    79* Add option which allows students to select a desired hostel before
  • main/waeup.kofa/trunk/docs/source/userdocs/students/workflow.rst

    r13098 r13484  
    66Studying at a higher education institution means following
    77orchestrated and repeatable patterns of activities or, in other
    8 words, following a workflow prescribed by the school regulations.
    9 This process starts with application for studying a programme
    10 offered by the school, and may end with de-registration of a
    11 student. But even after de-registration, former students can be kept
    12 in the system as alumni so that they can still access their records
    13 or can apply for official transcripts.
     8words, following a process workflow prescribed by the school
     9regulations. This process starts with application for studying a
     10programme offered by the school, and may end with de-registration of
     11a student. But even after de-registration, former students can be
     12kept in the system as alumni so that they can still access their
     13records or can apply for official transcripts.
    1414
    1515Kofa divides these 'repeatable patterns of activities' into two
    16 different and strictly seperated workflows: an application and a
    17 student registration workflow. The latter, which presupposes the
    18 admission of the student, will be described here.
     16different and strictly seperated process workflows: an application
     17and a student registration workflow. The latter, which presupposes
     18the admission of the student, will be described here.
    1919
    2020A worflow defines states and transitions between the states. The
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py

    r13476 r13484  
    115115    text = _('Manage accommodation section')
    116116
     117class HostelsStatisticsActionButton(ManageActionButton):
     118    grok.order(2)
     119    grok.context(IHostelsContainer)
     120    grok.view(HostelsContainerPage)
     121    grok.require('waeup.manageHostels')
     122    icon = 'actionicon_statistics.png'
     123    text = _('Bed statistics')
     124    target = 'statistics'
     125
    117126class HostelsContainerManagePage(KofaEditFormPage):
    118127    """The manage page for hostel containers.
     
    196205    def render(self):
    197206        return
     207
     208class HostelsStatisticsPage(KofaDisplayFormPage):
     209    """Some statistics about beds in hostels.
     210    """
     211    grok.context(IHostelsContainer)
     212    grok.name('statistics')
     213    grok.require('waeup.manageHostels')
     214    grok.template('containerstatistics')
     215    label = _('Bed Statistics')
    198216
    199217class HostelAddFormPage(KofaAddFormPage):
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py

    r13483 r13484  
    238238        stats = utils.getBedStatistics()
    239239        self.assertEqual(stats,
    240             {'regular_male_fr': (1, 1),
    241              'regular_female_fi': (0, 0),
    242              'regular_male_re': (0, 0),
    243              'regular_female_fr': (0, 0),
    244              'regular_female_all': (0, 0),
    245              'regular_female_re': (0, 0),
    246              'regular_male_fi': (0, 0),
    247              'regular_male_all': (0, 0)}
     240            {'regular_male_fr': (0, 1, 1),
     241             'regular_female_fi': (0, 0, 0),
     242             'regular_male_re': (0, 0, 0),
     243             'regular_female_fr': (0, 0, 0),
     244             'regular_female_all': (0, 0, 0),
     245             'regular_female_re': (0, 0, 0),
     246             'regular_female_reserved': (0, 0, 0),
     247             'regular_male_reserved': (0, 0, 0),
     248             'regular_male_fi': (0, 0, 0),
     249             'regular_male_all': (0, 0, 0)}
    248250             )
    249251        self.app[
     
    253255        stats = utils.getBedStatistics()
    254256        self.assertEqual(stats,
    255             {'regular_male_fr': (0, 1),
    256              'regular_female_fi': (0, 0),
    257              'regular_male_re': (0, 0),
    258              'regular_female_fr': (0, 0),
    259              'regular_female_all': (0, 0),
    260              'regular_female_re': (0, 0),
    261              'regular_male_fi': (0, 0),
    262              'regular_male_all': (0, 0)}
     257            {'regular_male_fr': (1, 0, 1),
     258             'regular_female_fi': (0, 0, 0),
     259             'regular_male_re': (0, 0, 0),
     260             'regular_female_fr': (0, 0, 0),
     261             'regular_female_all': (0, 0, 0),
     262             'regular_female_re': (0, 0, 0),
     263             'regular_female_reserved': (0, 0, 0),
     264             'regular_male_reserved': (0, 0, 0),
     265             'regular_male_fi': (0, 0, 0),
     266             'regular_male_all': (0, 0, 0)}
    263267             )
    264268
     
    478482        self.assertTrue('2 of 10' in self.browser.contents)
    479483        bedticket.bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
     484        # Managers can open the bed statistics page
     485        self.browser.getLink("Bed statistics").click()
     486        self.assertTrue('Bed Statistics</h1>' in self.browser.contents)
    480487        # Remove entire hostel.
    481488        self.browser.open(self.manage_container_path)
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/utils.py

    r13483 r13484  
    3939            'regular_female_fi',
    4040            'regular_female_all',
     41            'regular_female_reserved',
    4142            'regular_male_fr',
    4243            'regular_male_re',
    4344            'regular_male_fi',
    44             'regular_male_all',)
     45            'regular_male_all',
     46            'regular_male_reserved',)
    4547        for bed_type in bed_types:
    46             no = cat.searchResults(
     48            free = cat.searchResults(
    4749                bed_type=(bed_type, bed_type),
    4850                owner=(NOT_OCCUPIED, NOT_OCCUPIED))
    4951            all = cat.searchResults(
    5052                bed_type=(bed_type, bed_type))
    51             stats[bed_type] = (len(no), len(all))
     53            free = len(free)
     54            total = len(all)
     55            occ = total - free
     56            stats[bed_type] = (occ, free, total)
    5257        return stats
Note: See TracChangeset for help on using the changeset viewer.