Ignore:
Timestamp:
24 Oct 2011, 05:33:59 (13 years ago)
Author:
Henrik Bettermann
Message:

Create empty school fee, clearance and hostel application AC batches during initialization of university instance. These batches start with 0.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscode.py

    r6927 r6932  
    295295        """Get next unused num for given prefix.
    296296        """
    297         num = 1
     297        # School fee, clearance and hostel application batches start with 0.
     298        # These batches are being emptily created during initialization of the
     299        # university instance.
     300        if prefix in ('CLR', 'SFE', 'HOS'):
     301            num = 0
     302        else:
     303            num = 1
    298304        while self.get('%s-%s' % (prefix, num), None) is not None:
    299305            num += 1
     
    379385
    380386    def setup(self, site, name, logger):
    381         site['accesscodes'] = AccessCodeBatchContainer()
     387        basecontainer = AccessCodeBatchContainer()
     388        site['accesscodes'] = basecontainer
    382389        logger.info('Installed container for access code batches.')
     390        cost = 0.0
     391        creator = 'system'
     392        entry_num = 0
     393        creation_date = datetime.now()
     394        basecontainer.createBatch(creation_date, creator,
     395            'SFE', cost,entry_num)
     396        basecontainer.createBatch(creation_date, creator,
     397            'CLR', cost,entry_num)
     398        basecontainer.createBatch(creation_date, creator,
     399            'HOS', cost,entry_num)
    383400        return
    384401
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.txt

    r6552 r6932  
    5050For users that have the right to manage access-code related stuff, the
    5151home page of a `University` instance provides a link to the
    52 access-code management screen. In the beginning, there are naturally
    53 no batches available:
     52access-code management screen. In the beginning, there are already
     53three empty batches available which will be filled by online payments:
    5454
    5555    >>> browser.open('http://localhost/myuniversity')
     
    6161    ...
    6262    ... The following batches are available:
    63     ...No batches yet...
     63    ...CLR...
     64    ...HOS...
     65    ...SFE...
    6466    ...
    6567
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_accesscode.py

    r6728 r6932  
    288288        assert verifyClass(IAccessCodeBatch, AccessCodeBatch)
    289289
     290    def test_container_contents(self):
     291        assert 'SFE-0' in self.app['accesscodes']
     292        assert 'HOS-0' in self.app['accesscodes']
     293        assert 'CLR-0' in self.app['accesscodes']
     294
    290295    def test_csv_export(self):
    291296        # Make sure CSV export of accesscodes works
Note: See TracChangeset for help on using the changeset viewer.