Skip to content

Commit

Permalink
manila timezone info logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cferris32 committed Apr 23, 2024
1 parent 373a339 commit e1e0ecf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/vaos/app/services/vaos/v2/appointments_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AppointmentsService < VAOS::SessionService
FACILITY_ERROR_MSG = 'Error fetching facility details'
AVS_ERROR_MESSAGE = 'Error retrieving AVS link'
AVS_APPT_TEST_ID = '192308'
MANILA_PHILIPPINES_FACILITY_ID = '358'

AVS_FLIPPER = :va_online_scheduling_after_visit_summary
ORACLE_HEALTH_CANCELLATIONS = :va_online_scheduling_enable_OH_cancellations
Expand Down Expand Up @@ -410,6 +411,16 @@ def remove_service_type(appt)
def convert_appointment_time(appt)
if !appt[:start].nil?
facility_timezone = get_facility_timezone_memoized(appt[:location_id])
if appt[:location_id] == MANILA_PHILIPPINES_FACILITY_ID
Rails.logger.info(
"Timezone info for Manila Philippines location_id #{appt[:location_id]}",
{
location_id: appt[:location_id],
facility_timezone:,
appt_start_time: appt[:start]
}.to_json
)
end
appt[:local_start_time] = convert_utc_to_local_time(appt[:start], facility_timezone)
elsif !appt.dig(:requested_periods, 0, :start).nil?
appt[:requested_periods].each do |period|
Expand Down
27 changes: 27 additions & 0 deletions modules/vaos/spec/services/v2/appointment_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,33 @@
end
end

describe '#convert_appointment_time' do
let(:manila_appt) do
{
id: '12345',
location_id: '358',
start: '2024-12-20T00:00:00Z'
}
end

context 'when appt location id is 358' do
it 'logs the appt location id, timezone info, and appt start time' do
allow_any_instance_of(VAOS::V2::AppointmentsService)
.to receive(:get_facility_timezone_memoized)
.and_return('Asia/Manila')
allow(Rails.logger).to receive(:info)

subject.send(:convert_appointment_time, manila_appt)
expect(Rails.logger).to have_received(:info).with('Timezone info for Manila Philippines location_id 358',
{
location_id: '358',
facility_timezone: 'Asia/Manila',
appt_start_time: '2024-12-20T00:00:00Z'
}.to_json)
end
end
end

describe '#convert_utc_to_local_time' do
let(:start_datetime) { '2021-09-02T14:00:00Z'.to_datetime }

Expand Down

0 comments on commit e1e0ecf

Please sign in to comment.