Пример #1
0
def _build_notification_window_filter():
    if datetime.now().hour >= rb_settings.get('notification_hour'):
        # Both today and delayed notifications
        return ReservationOccurrence.is_in_notification_window()
    else:
        # Delayed notifications only
        return ReservationOccurrence.is_in_notification_window(exclude_first_day=True)
Пример #2
0
def _build_notification_window_filter():
    if datetime.now().hour >= rb_settings.get('notification_hour'):
        # Both today and delayed notifications
        return ReservationOccurrence.is_in_notification_window()
    else:
        # Delayed notifications only
        return ReservationOccurrence.is_in_notification_window(exclude_first_day=True)
def assert_is_in_notification_window(occurrence, expected, expected_with_exclude):
    assert occurrence.is_in_notification_window() == expected
    assert occurrence.is_in_notification_window(exclude_first_day=True) == expected_with_exclude
    assert ReservationOccurrence.find_first(
        ReservationOccurrence.is_in_notification_window()) == (occurrence if expected else None)
    assert ReservationOccurrence.find_first(
        ReservationOccurrence.is_in_notification_window(exclude_first_day=True)) == (occurrence if
                                                                                     expected_with_exclude
                                                                                     else None)
def assert_is_in_notification_window(occurrence, expected, expected_with_exclude):
    assert occurrence.is_in_notification_window() == expected
    assert occurrence.is_in_notification_window(exclude_first_day=True) == expected_with_exclude
    assert ReservationOccurrence.find_first(
        ReservationOccurrence.is_in_notification_window()) == (occurrence if expected else None)
    assert ReservationOccurrence.find_first(
        ReservationOccurrence.is_in_notification_window(exclude_first_day=True)) == (occurrence if
                                                                                     expected_with_exclude
                                                                                     else None)