Changeset 627 for WAeUP_SRP


Ignore:
Timestamp:
9 Oct 2006, 10:02:41 (18 years ago)
Author:
joachim
Message:

counting error corrected, cleartext bed_type names

Location:
WAeUP_SRP/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Accommodation.py

    r626 r627  
    2323    portal_type = meta_type
    2424    security = ClassSecurityInfo()
    25 
     25   
    2626    security.declareProtected(View,"Title")
    2727    def Title(self):
    2828        """compose title"""
    29         return "Accommodation Halls"
     29        return "Accommodation"   
    3030
    3131    security.declareProtected(ModifyPortalContent,"generateFreeBedsList") ###(
     
    5252            if h.which_sex:
    5353                sex = 'female'
    54             for block in range(1,int(h.nr_of_blocks)):
    55                 for floor in range(1,int(h.nr_of_floors)):
    56                     for room in range(1,int(h.rooms_per_floor)):
     54            for block in range(1,int(h.nr_of_blocks)+1):
     55                for floor in range(1,int(h.nr_of_floors)+1):
     56                    for room in range(1,int(h.rooms_per_floor)+1):
    5757                        for bed in 'ABCDEFGH'[:int(h.beds_per_room)]:
    5858                            room_nr = floor*100 + room
     
    6969                            uid = '%s_%d_%d_%s' % (hall.getId(),block,room_nr,bed)
    7070                            try:
    71                                 freelist.addRecord(bed = uid, bed_type = bt,hall =hall.getId())
     71                                freelist.addRecord(bed = uid, bed_type = bt,hall = hall.getId())
    7272                                count +=1
    7373                                generated.append('"%(uid)s","%(bt)s"' % vars())
    7474                            except ValueError:
    75                                 freelist.modifyRecord(bed = uid, bed_type = bt,hall =hall.getId())
     75                                #freelist.modifyRecord(bed = uid, bed_type = bt,hall =hall.getId())
    7676                                pass
    7777            hall_gen['count']= count
  • WAeUP_SRP/trunk/profiles/default/types.xml

    r622 r627  
    1616 <object name="Semester" meta_type="CPS Flexible Type Information"/>
    1717 <object name="Student" meta_type="CPS Flexible Type Information"/>
     18 <object name="StudentAccommodation" meta_type="CPS Flexible Type Information"/>
    1819 <object name="StudentStudyLevel" meta_type="CPS Flexible Type Information"/>
    1920 <object name="StudentStudyCourse" meta_type="CPS Flexible Type Information"/>
  • WAeUP_SRP/trunk/skins/waeup_accommodation/acco_hall_view.pt

    r622 r627  
    1111      <h3 tal:content="here/title_or_id" />
    1212      <div tal:condition="nothing" tal:content="info/container_path"/>
     13      <table tal:condition="info/bed_types"
     14             tal:define="bed_types info/bed_types">
     15        <tr>
     16          <th>Bed Type</th>
     17          <th>Beds</th>
     18        </tr>
     19        <tr tal:repeat="bt bed_types">
     20          <td tal:content="bt/name" />
     21          <td tal:content="bt/count" />
     22        </tr>
     23        <tr><td>&nbsp;</td></tr>
     24      </table>
    1325    </metal:block>
    1426    <metal:main fill-slot="main">
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallsInfo.py

    r626 r627  
    3838bed_types = pa.uniqueValuesFor('bed_type')
    3939bt_list = []
     40bt_names =  context.getBedTypeNames()
    4041for bt in bed_types:
    4142    res = pa(bed_type=bt)
    42     bt_list.append({'name': bt, 'count': len(res)})
     43    bt_list.append({'name': bt_names[bt], 'count': len(res)})
    4344info['bed_types'] = bt_list
    4445reserved = pa.uniqueValuesFor('student')
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getHallInfo.py

    r622 r627  
    1717path_info = request.get('PATH_INFO').split('/')
    1818mtool = context.portal_membership
    19 
     19pa = context.portal_accommodation
    2020info = {}
    2121#dep_id = request.get('PATH_TRANSLATED').split('/')[-2]
     
    2626info['choosen_ids'] = request.get('ids',[])
    2727info['doc'] = context.getContent()
     28bed_types = pa.uniqueValuesFor('bed_type')
     29bt_list = []
     30bt_names =  context.getBedTypeNames()
     31for bt in bed_types:
     32    res = pa(bed_type=bt,hall=context.getId())
     33    bt_list.append({'name': bt_names[bt], 'count': len(res)})
     34info['bed_types'] = bt_list
     35
    2836return info
Note: See TracChangeset for help on using the changeset viewer.