Ignore:
Timestamp:
15 Jan 2007, 09:57:20 (18 years ago)
Author:
joachim
Message:

correct Hall Statistic

Location:
WAeUP_SRP/trunk/skins/waeup_accommodation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_accommodation/acco_folder_view.pt

    r913 r1297  
    3535          <td tal:content="bt/total" />
    3636          <td tal:content="bt/reserved" />
     37          <td tal:condition="bt/full|nothing">
     38          <strong>Fully booked</strong>
     39        </td>
    3740        </tr>
    3841      </table>
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoFolderInfo.py

    r1138 r1297  
    4848                    'total': total,
    4949                    'reserved': free,
     50                    'full': free == total,
    5051                    })
    5152bt_list.append({'name': "Total",
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallInfo.py

    r1269 r1297  
    1919
    2020request = context.REQUEST
    21 #from Products.zdb import set_trace;set_trace()
    2221
    2322wf = context.portal_workflow
     
    3433bt_list = []
    3534bt_names =  context.getBedTypeNames()
    36 reserved = pa.uniqueValuesFor('student')
     35all_booked = pa.uniqueValuesFor('student')
     36booked_list = []
     37#from Products.zdb import set_trace;set_trace()
    3738for bt in bed_types:
    3839    total = len(pa(bed_type=bt,hall=context.getId()))
    3940    if total <= 1:
    4041        continue
    41     free = len(pa.searchResults({'bed_type': bt,
    42                                  'student':reserved,
    43                                  'hall': context.getId()}))
     42    booked = pa.searchResults({'bed_type': bt,
     43                                 'student':all_booked,
     44                                 'hall': context.getId()})
    4445    bt_list.append({'name': bt_names[bt],
    4546                    'total': total,
    46                     'reserved': free,
     47                    'reserved': len(booked),
    4748                    })
     49    booked_list.extend(booked)
    4850info['bed_types'] = bt_list
    4951res_list = []
    5052students_url = "%s/campus/students" % (context.portal_url())
    51 if reserved:
    52     for st in reserved:
    53         if st:
    54             res = pa(hall=context.getId(),student=st)
    55             if not res:
    56                 continue
    57             d = {}
    58             d['student'] = st
    59             d['student_url'] ='%s/%s' % (students_url,st)
    60             bed = context.formatBed(res[0].bed).split('/')
    61             d['bed'] = " / ".join(bed[1:])
    62             erg = context.students_catalog(id = st)
    63             if erg:
    64                 sd = context.getFormattedStudentEntry(erg[0])
    65                 d.update(sd)
    66             res_list.append(d)
     53for sbrain in booked_list:
     54    d = {}
     55    st = sbrain.student
     56    if not st:
     57        continue
     58    d['student'] = st
     59    d['student_url'] ='%s/%s' % (students_url,st)
     60    bed = context.formatBed(sbrain.bed).split('/')
     61    d['bed'] = " / ".join(bed[1:])
     62    erg = context.students_catalog(id = st)
     63    if erg:
     64        sd = context.getFormattedStudentEntry(erg[0])
     65        d.update(sd)
     66    res_list.append(d)
    6767res_list.sort(cmp_bed)
    6868info['reserved'] = res_list
Note: See TracChangeset for help on using the changeset viewer.