Skip to content

Commit

Permalink
Try reverting error behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
JunTaoLuo committed Sep 5, 2024
1 parent 84afd7d commit b3fc3f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module V2
class AppointmentsController < VAOS::BaseController
STATSD_KEY = 'api.vaos.va_mobile.response.partial'
PAP_COMPLIANCE_TELE = 'PAP COMPLIANCE/TELE'
FACILITY_ERROR_MSG = 'Error fetching facility details'
APPT_INDEX_VAOS = "GET '/vaos/v1/patients/<icn>/appointments'"
APPT_INDEX_VPG = "GET '/vpg/v1/patients/<icn>/appointments'"
APPT_SHOW_VAOS = "GET '/vaos/v1/patients/<icn>/appointments/<id>'"
Expand All @@ -19,6 +20,7 @@ class AppointmentsController < VAOS::BaseController

def index
appointments[:data].each do |appt|
set_facility_error_msg(appt) if include_params[:facilities]
scrape_appt_comments_and_log_details(appt, index_method_logging_name, PAP_COMPLIANCE_TELE)
log_appt_creation_time(appt)
end
Expand All @@ -37,6 +39,7 @@ def index

def show
appointment
set_facility_error_msg(appointment)

scrape_appt_comments_and_log_details(appointment, show_method_logging_name, PAP_COMPLIANCE_TELE)
log_appt_creation_time(appointment)
Expand All @@ -48,6 +51,7 @@ def show

def create
new_appointment
set_facility_error_msg(new_appointment)

scrape_appt_comments_and_log_details(new_appointment, create_method_logging_name, PAP_COMPLIANCE_TELE)

Expand All @@ -58,6 +62,7 @@ def create

def update
updated_appointment
set_facility_error_msg(updated_appointment)

serializer = VAOS::V2::VAOSSerializer.new
serialized = serializer.serialize(updated_appointment, 'appointments')
Expand All @@ -66,6 +71,10 @@ def update

private

def set_facility_error_msg(appointment)
appointment[:location] = FACILITY_ERROR_MSG if appointment[:location_id].present? && appointment[:location].nil?
end

def appointments_service
@appointments_service ||=
VAOS::V2::AppointmentsService.new(current_user)
Expand Down
5 changes: 1 addition & 4 deletions modules/vaos/app/services/vaos/v2/appointments_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class AppointmentsService < VAOS::SessionService # rubocop:disable Metrics/Class
AVS_ERROR_MESSAGE = 'Error retrieving AVS link'
AVS_APPT_TEST_ID = '192308'
MANILA_PHILIPPINES_FACILITY_ID = '358'
FACILITY_ERROR_MSG = 'Error fetching facility details'

AVS_FLIPPER = :va_online_scheduling_after_visit_summary
ORACLE_HEALTH_CANCELLATIONS = :va_online_scheduling_enable_OH_cancellations
Expand Down Expand Up @@ -298,9 +297,7 @@ def merge_clinic(appt)
end

def merge_facility(appt)
return if appt[:location_id].nil?

appt[:location] = mobile_facility_service.get_facility(appt[:location_id]) || FACILITY_ERROR_MSG
appt[:location] = mobile_facility_service.get_facility(appt[:location_id]) unless appt[:location_id].nil?
VAOS::AppointmentsHelper.log_appt_id_location_name(appt)
end

Expand Down

0 comments on commit b3fc3f6

Please sign in to comment.