def updateBookingsCacheContentAfterPropertyChange(a_holly_couch, a_visiting_group,  logged_in_user_id):
    """after propertes have been changed, the bookings needs to have their cache content updated"""
    # TODO: if cachecontent changes, should we change booking status or somehow mark it?
    
    is_new_group = not a_visiting_group.has_key('_id')
    if is_new_group:
        return
    
    l_visiting_group_name = a_visiting_group['name']
    l_visiting_group_id = a_visiting_group['_id']
    bookings = getBookingsOfVisitingGroup(a_holly_couch, a_visiting_group.id,  None)
    for tmp in bookings:
        tmp_booking = tmp.doc
        
        new_content = computeCacheContent(a_visiting_group, tmp_booking['content'])
        if new_content != tmp_booking['cache_content'] :

            if new_content != tmp_booking['cache_content']:
                tmp_booking['cache_content'] = new_content
                tmp_booking['last_changed_by'] = logged_in_user_id 
                
                #...we need booking day of booking if it exists
                
                
                remember_booking_vgroup_properties_change(a_holly_couch, booking=tmp_booking, visiting_group_id=l_visiting_group_id,  visiting_group_name=l_visiting_group_name, changed_by=logged_in_user_id,  activity_title=a_holly_couch[tmp_booking['activity_id']]['title'])
                a_holly_couch[tmp_booking['_id']] = tmp_booking
示例#2
0
 def get_program_layer_bookings(self,  visiting_group,  layer_title,  layer_colour):
     bookings = []
     for tmp in getBookingsOfVisitingGroup(holly_couch, visiting_group['name'], '<- MATCHES NO GROUP ->'):
         tmp_doc = tmp.doc
         tmp_doc['layer_title'] = layer_title
         tmp_doc['layer_colour'] = layer_colour
         bookings.append(tmp_doc)
     return bookings
示例#3
0
    def view_bookings_of_name(self,  name=None, render_time='', hide_comment=0, show_group=0):
        # TODO: its now possible to get bookings on both name and id
        bookings = [b.doc for b in getBookingsOfVisitingGroup(holly_couch, name, '<- MATCHES NO GROUP ->')]

        visiting_group_id = None
        visiting_group = [v.doc for v in getVisitingGroupOfVisitingGroupName(holly_couch, name)]
        if len(visiting_group) > 1:
            log.error("two visiting groups with the same name")

        if len(visiting_group) == 1:
            visiting_group_id = visiting_group[0]['_id']

            first_visiting_group = visiting_group[0]

        return self.view_bookings_of_visiting_group(first_visiting_group, visiting_group_id, name, bookings, hide_comment=hide_comment, show_group=show_group, render_time=render_time)
示例#4
0
    def view_bookings_of_visiting_group_id(self, visiting_group_id=None, render_time='', hide_comment=0, show_group=0):

        bookings = [b.doc for b in getBookingsOfVisitingGroup(holly_couch, '<- MATCHES NO GROUP ->', visiting_group_id)]
        visiting_group = common_couch.getVisitingGroup(holly_couch,  visiting_group_id)
        return self.view_bookings_of_visiting_group(visiting_group, visiting_group_id, visiting_group['name'], bookings, hide_comment=hide_comment, show_group=show_group, render_time=render_time)