Ignore:
Timestamp:
31 Oct 2011, 04:35:23 (13 years ago)
Author:
Henrik Bettermann
Message:

We don't need special handling codes with and without categorization like in SRP. A new beds_for_all field is sufficient to configure these hostels.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser_templates/hostelmanagepage.pt

    r6970 r6971  
    6767        <tr>
    6868          <th>&nbsp;</th>
    69           <th>Bed Id</th>
    70           <th>Bed Type</th>
    71           <th>Sort Id</th>
     69          <th>Id</th>
     70          <th>Type</th>
     71          <th>Number</th>
    7272          <th>Owner</th>
    7373        </tr>
     
    8080          </td>
    8181          <td> <a tal:attributes="href value/__name__">
    82           <span tal:content="value/bed_id">Bed Id</span>
     82          <span tal:content="value/bed_id">Id</span>
    8383          </a></td>
    84           <td tal:content="value/bed_type">Bed Type</td>
    85           <td tal:content="value/sort_id">Sort Id</td>
     84          <td tal:content="value/bed_type">Type</td>
     85          <td tal:content="value/bed_number">Number</td>
    8686          <td tal:content="value/owner">Owner</td>
    8787        </tr>
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py

    r6970 r6971  
    5656        beds_for_returning = getattr(self,'beds_for_returning',[])
    5757        beds_for_final = getattr(self,'beds_for_final',[])
     58        beds_for_all = getattr(self,'beds_for_all',[])
    5859        beds_reserved = [] #temporarily empty
    5960        all_blocks = blocks_for_female + blocks_for_male
    6061        all_beds = (beds_for_pre + beds_for_fresh +
    61             beds_for_returning + beds_for_final)
     62            beds_for_returning + beds_for_final + beds_for_all)
    6263        #import pdb;pdb.set_trace()
    6364        for block in all_blocks:
     
    7273                        if (block,room_nr) in beds_reserved:
    7374                            bt = "reserved"
    74                         # Hostels with special handling and
    75                         # without bed categorisation
    76                         elif (self.special_handling != 'none' and not
    77                               self.special_handling.endswith("_withcat")):
    78                             bt = self.special_handling[3:]
    7975                        elif bed in beds_for_fresh:
    8076                            bt = 'fr'
     
    8581                        elif bed in beds_for_returning:
    8682                            bt = 're'
    87                         # Hostels with special handling and
    88                         # with bed categorisation
    89                         if (self.special_handling != 'none' and
    90                             self.special_handling.endswith("_withcat")):
     83                        # Hostels with special handling
     84                        if self.special_handling != 'none':
    9185                            bt += "_" + self.special_handling
    9286                        bt = u'%(sex)s_%(bt)s' % vars()
     
    9690                            if bed.bed_type != bt:
    9791                                bed.bed_type = bt
    98                                 bed.sort_id = getattr(self,'sort_id',0)
    9992                                #modified.append('"%(uid)s","%(bt)s","%(bed.owner)s"' % vars())
    10093                                modified_counter += 1
     
    10396                            bed.bed_id = uid
    10497                            bed.bed_type = bt
    105                             bed.sort_id = getattr(self,'sort_id',0)
     98                            bed.bed_number = len(self) + 1
    10699                            bed.owner = NOT_OCCUPIED
    107100                            self.addBed(bed)
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py

    r6970 r6971  
    4545        title = u'Floors per Block',
    4646        required = True,
    47         default = 3,
     47        default = 1,
    4848        )
    4949
     
    5151        title = u'Rooms per Floor',
    5252        required = True,
    53         default = 20,
     53        default = 2,
    5454        )
    55 
    56     #beds_per_room = schema.Int(
    57     #    title = u'Beds per Room',
    58     #    required = True,
    59     #    default = 6,
    60     #    )
    6155
    6256    blocks_for_female = schema.List(
     
    9589        )
    9690
     91    beds_for_all = schema.List(
     92        title = u'Beds without category',
     93        value_type = schema.Choice(
     94            vocabulary = bed_letters
     95            ),
     96        )
     97
    9798    special_handling = schema.Choice(
    9899        title = u'Special Handling',
     
    125126            raise Invalid('Bed categories overlap.')
    126127
    127     #@invariant
    128     #def numberOfBeds(hostel):
    129     #    bfr = hostel.beds_for_fresh
    130     #    bre = hostel.beds_for_returning
    131     #    bfi = hostel.beds_for_final
    132     #    if len(bfr + bre + bfi) != hostel.beds_per_room:
    133     #        raise Invalid(
    134     #            'Bed categories and number of beds per room do not match.')
    135 
    136128class IBed(IWAeUPObject):
    137129    """A base representation of beds.
     
    159151        )
    160152
    161     sort_id = schema.Int(
    162         title = u'Sort Id',
     153    bed_number = schema.Int(
     154        title = u'Bed Number',
    163155        required = True,
    164         default = 100,
    165156        )
    166157
Note: See TracChangeset for help on using the changeset viewer.