Changeset 13533


Ignore:
Timestamp:
3 Dec 2015, 20:04:17 (9 years ago)
Author:
Henrik Bettermann
Message:

Reserve bed so that it cannot be automatically booked by someone else.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/hostels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py

    r13529 r13533  
    203203            message = ', '.join(released)
    204204            self.context.writeLogMessage(self, 'released: %s' % message)
    205             flash_msg = _('Successfully released beds: ${a}',
    206                 mapping = {'a':message})
     205            if len(released) > 50:
     206                flash_msg = _('Successfully released ${a} beds.',
     207                    mapping = {'a':len(released)})
     208            else:
     209                flash_msg = _('Successfully released beds: ${a}',
     210                    mapping = {'a':message})
    207211        else:
    208212            flash_msg = _('No bed released.')
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py

    r13440 r13533  
    227227
    228228    def releaseBed(self):
     229        """Release bed.
     230        """
    229231        if self.owner == NOT_OCCUPIED:
    230232            return
     
    247249
    248250    def releaseBedIfMaintenanceNotPaid(self, n=7):
     251        """Release bed if maintenance fee has not been paid on time.
     252        Reserve bed so that it cannot be automatically booked by someone else.
     253        """
    249254        if self.owner == NOT_OCCUPIED:
    250255            return
     
    263268            old_owner = self.owner
    264269            self.owner = NOT_OCCUPIED
     270            sh, sex, bt = self.bed_type.split('_')
     271            bt = u'%s_%s_reserved' % (sh, sex)
     272            self.bed_type = bt
    265273            notify(grok.ObjectModifiedEvent(self))
    266274            bedticket.bed = None
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py

    r13483 r13533  
    246246    def releaseBedIfMaintenanceNotPaid():
    247247        """Release bed if maintenance fee has not been paid on time.
     248        Reserve bed so that it cannot be automatically booked by someone else.
    248249        """
    249250
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py

    r13529 r13533  
    198198        notify(grok.ObjectModifiedEvent(
    199199            self.app['hostels']['hall-x']['hall_block_room_bed']))
     200        self.assertEqual(
     201            self.app['hostels']['hall-x']['hall_block_room_bed'].bed_type,
     202            'regular_male_fr')
    200203        results = cat.searchResults(owner=(self.student_id, self.student_id))
    201204        self.assertEqual(len(results), 1)
     
    216219        self.assertMatches(bedticket.display_coordinates,
    217220            '-- booking expired (2015-10-14 08:35:38 UTC) --')
     221        # The owner has been removed and the bed reserved.
    218222        self.assertEqual(
    219223            self.app['hostels']['hall-x']['hall_block_room_bed'].owner,
    220224            NOT_OCCUPIED)
     225        self.assertEqual(
     226            self.app['hostels']['hall-x']['hall_block_room_bed'].bed_type,
     227            'regular_male_reserved')
    221228        # Accommodation session can't be changed if hostels are not empty.
    222229        self.browser.open(self.manage_container_path)
Note: See TracChangeset for help on using the changeset viewer.