Changeset 1438 for WAeUP_SRP/trunk/skins/waeup_accommodation
- Timestamp:
- 19 Feb 2007, 14:44:39 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_accommodation
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_accommodation/acco_folder_view.pt
r1298 r1438 10 10 Up one level 11 11 </a> 12 13 <a href="statistics_bed_view"><strong>Bed Statistics</strong></a> 14 12 15 <h3 tal:content="here/title_or_id"> 13 16 Page Title … … 24 27 </tr> 25 28 </table> 26 <table tal:condition="info/bed_types" 27 tal:define="bed_types info/bed_types"> 28 <tr> 29 <th width="200px">Bed Category</th> 30 <th width="80px">Total</th> 31 <th width="80px">Booked</th> 32 </tr> 33 <tr tal:repeat="bt bed_types"> 34 <td tal:content="bt/name" /> 35 <td tal:content="bt/total" /> 36 <td tal:content="bt/reserved" /> 37 <td tal:condition="bt/full|nothing"> 38 <strong>Fully booked</strong> 39 </td> 40 </tr> 41 </table> 29 42 30 </metal:block> 43 31 <metal:main fill-slot="main"> -
WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoFolderInfo.py
r1301 r1438 33 33 items.append(row) 34 34 info['items'] = items 35 pa = context.portal_accommodation 36 bed_types = pa.uniqueValuesFor('bed_type') 37 bt_list = [] 38 bt_names = context.getBedTypeNames() 39 res = pa.uniqueValuesFor('student') 40 reserved = [st for st in res if st] 41 sum_total = 0 42 sum_occupied = 0 43 #from Products.zdb import set_trace;set_trace() 44 for bt in bed_types: 45 total = len(pa(bed_type=bt)) 46 sum_total += total 47 occupied = len(pa.searchResults({'bed_type': bt,'student':reserved})) 48 sum_occupied += occupied 49 bt_list.append({'name': bt_names[bt], 50 'total': total, 51 'reserved': occupied, 52 'full': occupied == total, 53 }) 54 bt_list.append({'name': "All Categories", 55 'total': sum_total, 56 'reserved': sum_occupied, 57 }) 58 info['bed_types'] = bt_list 59 reserved = pa.uniqueValuesFor('student') 60 res_list = [] 61 if reserved > 1: 62 for st in reserved: 63 if st: 64 res = pa(student=st) 65 res_list.append({'student': st, 'bed': res[0].bed }) 66 info['reserved'] = res_list 35 67 36 68 37 return info
Note: See TracChangeset for help on using the changeset viewer.