diff --git a/engine/apps/api/serializers/on_call_shifts.py b/engine/apps/api/serializers/on_call_shifts.py index 7b561c38..9ef9130b 100644 --- a/engine/apps/api/serializers/on_call_shifts.py +++ b/engine/apps/api/serializers/on_call_shifts.py @@ -116,9 +116,9 @@ class OnCallShiftSerializer(EagerLoadingMixin, serializers.ModelSerializer): ) if frequency not in (CustomOnCallShift.FREQUENCY_WEEKLY, CustomOnCallShift.FREQUENCY_DAILY) and by_day: raise serializers.ValidationError({"by_day": ["Cannot set days value for this frequency type"]}) - if frequency == CustomOnCallShift.FREQUENCY_DAILY and by_day and interval > 1: + if frequency == CustomOnCallShift.FREQUENCY_DAILY and by_day and interval != 1: raise serializers.ValidationError( - {"interval": ["Cannot set interval > 1 if a days value is set for a daily frequency"]} + {"interval": ["Interval must be 1 if a days value is set for a daily frequency"]} ) def _validate_rotation_start(self, shift_start, rotation_start): diff --git a/engine/apps/api/tests/test_oncall_shift.py b/engine/apps/api/tests/test_oncall_shift.py index 807eb8a6..945ecf50 100644 --- a/engine/apps/api/tests/test_oncall_shift.py +++ b/engine/apps/api/tests/test_oncall_shift.py @@ -789,7 +789,7 @@ def test_create_on_call_shift_invalid_data_interval(on_call_shift_internal_api_s assert response.status_code == status.HTTP_400_BAD_REQUEST assert response.data["interval"][0] == "Cannot set interval for non-recurrent shifts" - # by_day, daily, interval > 1 + # by_day, daily, interval != 1 data = { "title": "Test Shift 2", "type": CustomOnCallShift.TYPE_ROLLING_USERS_EVENT, @@ -808,7 +808,7 @@ def test_create_on_call_shift_invalid_data_interval(on_call_shift_internal_api_s response = client.post(url, data, format="json", **make_user_auth_headers(user1, token)) assert response.status_code == status.HTTP_400_BAD_REQUEST - assert response.data["interval"][0] == "Cannot set interval > 1 if a days value is set for a daily frequency" + assert response.data["interval"][0] == "Interval must be 1 if a days value is set for a daily frequency" @pytest.mark.django_db