Exemple #1
0
def get_suggestions(filters, limit=None):
    blocked_rooms = get_blocked_rooms(filters['start_dt'], filters['end_dt'], [BlockedRoomState.accepted])
    rooms = [room for room in search_for_rooms(filters, availability=False) if room not in blocked_rooms]
    if filters['repeat_frequency'] == RepeatFrequency.NEVER:
        suggestions = sort_suggestions(get_single_booking_suggestions(rooms, filters['start_dt'], filters['end_dt'],
                                                                      limit=limit))
    else:
        suggestions = sort_suggestions(get_recurring_booking_suggestions(rooms, filters['start_dt'], filters['end_dt'],
                                                                         filters['repeat_frequency'],
                                                                         filters['repeat_interval'], limit=limit))
    for entry in suggestions:
        entry['room_id'] = entry.pop('room').id
    return suggestions
Exemple #2
0
def get_suggestions(filters, limit=None):
    blocked_rooms = get_blocked_rooms(filters['start_dt'], filters['end_dt'], [BlockedRoomState.accepted])
    rooms = [room for room in search_for_rooms(filters, availability=False) if room not in blocked_rooms]
    if filters['repeat_frequency'] == RepeatFrequency.NEVER:
        suggestions = sort_suggestions(get_single_booking_suggestions(rooms, filters['start_dt'], filters['end_dt'],
                                                                      limit=limit))
    else:
        suggestions = sort_suggestions(get_recurring_booking_suggestions(rooms, filters['start_dt'], filters['end_dt'],
                                                                         filters['repeat_frequency'],
                                                                         filters['repeat_interval'], limit=limit))
    for entry in suggestions:
        entry['room_id'] = entry.pop('room').id
    return suggestions