Changeset 6981


Ignore:
Timestamp:
1 Nov 2011, 08:50:26 (13 years ago)
Author:
Henrik Bettermann
Message:

Simplify invariant bedsOverlap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py

    r6976 r6981  
    123123    @invariant
    124124    def bedsOverlap(hostel):
    125         bfr = hostel.beds_for_fresh
    126         bre = hostel.beds_for_returning
    127         bfi = hostel.beds_for_final
    128         if (set(bfr).intersection(set(bre)) or
    129             set(bfr).intersection(set(bfi)) or
    130             set(bre).intersection(set(bfi))):
     125        beds = (hostel.beds_for_fresh +
     126                hostel.beds_for_returning +
     127                hostel.beds_for_final +
     128                hostel.beds_for_all)
     129        if len(beds) != len(set(beds)):
    131130            raise Invalid('Bed categories overlap.')
    132131
Note: See TracChangeset for help on using the changeset viewer.