Skip to content

Commit

Permalink
remove change on multistatus response
Browse files Browse the repository at this point in the history
  • Loading branch information
aherzberg committed Apr 24, 2024
1 parent 8f57c16 commit 8f5f710
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,19 @@ def fetch_appointments
# The mobile app does not distinguish between VA and CC errors so we are only indicating that there are errors
# If we ever want to distinguish be VA and CC errors, it will require coordination with the front-end team
def partial_errors(failures)
if failures.any?
Rails.logger.info('Mobile Appointment Partial Error', errors: failures)

if appointment_errors?(failures)
{
errors: [{ source: 'VA Service' }]
}
end
end

def get_response_status(failures)
failures.any? ? :multi_status : :ok
appointment_errors?(failures) ? :multi_status : :ok
end

def appointment_errors?(failures)
failures.any? { |failure| failure[:appointment_errors].present? }
end

def filter_by_date_range(appointments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_appointments(start_date:, end_date:, include_pending:, pagination_params
{ missing_providers: }
]
failures.reject! { |failure| failure.values.first&.empty? }
Rails.logger.info('Mobile Appointment Partial Error', errors: failures) if failures.any?

[appointments.sort_by(&:start_date_utc), failures]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
end
end
end
expect(response).to have_http_status(:multi_status)
expect(response).to have_http_status(:ok)
expect(Rails.logger).to have_received(:info).with('Mobile Appointment Partial Error',
errors: [{ missing_facilities: ['983'] }])
expect(response.body).to match_json_schema('VAOS_v2_appointments')
Expand Down Expand Up @@ -168,7 +168,7 @@
end
end
end
expect(response).to have_http_status(:multi_status)
expect(response).to have_http_status(:ok)
expect(Rails.logger).to have_received(:info).with('Mobile Appointment Partial Error',
errors: [{ missing_facilities: ['999AA'] },
{ missing_clinics: ['999'] }])
Expand Down Expand Up @@ -310,7 +310,7 @@ def fetch_appointments
end
end
end
expect(response).to have_http_status(:multi_status)
expect(response).to have_http_status(:ok)
expect(appointment['attributes']['healthcareProvider']).to be_nil
expect(Rails.logger).to have_received(:info).with('Mobile Appointment Partial Error',
errors: [{ missing_providers: ['1407938061'] }])
Expand All @@ -329,7 +329,7 @@ def fetch_appointments
end
end
end
expect(response).to have_http_status(:multi_status)
expect(response).to have_http_status(:ok)
expect(appointment['attributes']['healthcareProvider']).to be_nil
expect(Rails.logger).to have_received(:info).with('Mobile Appointment Partial Error',
errors: [{ missing_providers: ['1407938061'] }])
Expand Down

0 comments on commit 8f5f710

Please sign in to comment.