Changeset 3007 for WAeUP_SRP/base/skins


Ignore:
Timestamp:
11 Jan 2008, 07:02:36 (17 years ago)
Author:
Henrik Bettermann
Message:

fix bed statistics

Location:
WAeUP_SRP/base/skins/waeup_accommodation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_accommodation/getBedStatistics.py

    r1438 r3007  
    1515bt_names =  context.getBedTypeNames()
    1616res = pa.uniqueValuesFor('student')
    17 reserved = [st for st in res if st]
     17occupied_types = [st for st in res if st and st != 'not_occupied']
    1818sum_total = 0
    1919sum_occupied = 0
     
    2323    total = len(pa(bed_type=bt))
    2424    sum_total += total
    25     occupied = len(pa.searchResults({'bed_type': bt,'student':reserved}))
     25    occupied = len(pa.searchResults({'bed_type': bt,'student':occupied_types}))
    2626    sum_occupied += occupied
    2727    bt_list.append({'name': bt_names[bt],
    2828                    'total': total,
    29                     'reserved': occupied,
     29                    'occupied': occupied,
    3030                    'full': occupied == total,
    3131                    })
    3232bt_list.append({'name': "All Categories",
    3333                'total': sum_total,
    34                 'reserved': sum_occupied,
     34                'occupied': sum_occupied,
    3535                })
    3636info['bed_types'] = bt_list
    37 reserved = pa.uniqueValuesFor('student')
    38 res_list = []
    39 if reserved > 1:
    40     for st in reserved:
    41         if st:
    42             res = pa(student=st)
    43             res_list.append({'student': st, 'bed': res[0].bed })
    44 info['reserved'] = res_list
     37
     38#reserved = pa.uniqueValuesFor('student')
     39#res_list = []
     40#if reserved > 1:
     41#    for st in reserved:
     42#        if st:
     43#            res = pa(student=st)
     44#            res_list.append({'student': st, 'bed': res[0].bed })
     45#info['reserved'] = res_list
     46                 
    4547return info
  • WAeUP_SRP/base/skins/waeup_accommodation/statistics_bed_view.pt

    r1438 r3007  
    1818          <td tal:content="bt/name" />
    1919          <td tal:content="bt/total" />
    20           <td tal:content="bt/reserved" />
     20          <td tal:content="bt/occupied" />
    2121          <td tal:condition="bt/full|nothing">
    2222          <strong>Fully booked</strong>
Note: See TracChangeset for help on using the changeset viewer.