Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Merge appointment filterer logic and update timezone window #19843

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ features:
actor_type: user
description: Enables enhancement to the 21-526EZ "Add Disabilities" page being implemented by the Conditions Team.
enable_in_development: true
appointments_consolidation:
actor_type: user
description: For features being tested while merging logic for appointments between web and mobile
ask_va_form_feature:
actor_type: user
description: show/hide experimental features for Ask VA 0873
Expand Down
5 changes: 0 additions & 5 deletions modules/mobile/app/services/mobile/v2/appointments/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ def get_appointments(start_date:, end_date:, include_pending:, pagination_params

appointments = response[:data]

unless Flipper.enabled?(:appointments_consolidation, @user)
filterer = VAOS::V2::AppointmentsPresentationFilter.new
appointments = appointments.keep_if { |appt| filterer.user_facing?(appt) }
end

appointments = vaos_v2_to_v0_appointment_adapter.parse(appointments)

[appointments.sort_by(&:start_date_utc), response[:meta][:failures]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
let!(:user) { sis_user(icn: '1012846043V576341', vha_facility_ids: [402, 555]) }

before do
Flipper.enable_actor(:appointments_consolidation, user)
Flipper.disable(:va_online_scheduling_vaos_alternate_route)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def presentable_requested_appointment?(appointment)
return false unless created_at

valid_appointment_request?(appointment) && appointment[:status].in?(%w[proposed cancelled]) &&
created_at.between?(120.days.ago.beginning_of_day, 1.day.from_now.end_of_day)
created_at.between?(120.days.ago.beginning_of_day, 2.days.from_now.end_of_day)
end

def valid_appointment?(appointment)
Expand Down
7 changes: 3 additions & 4 deletions modules/vaos/app/services/vaos/v2/appointments_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ def get_appointments(start_date, end_date, statuses = nil, pagination_params = {
cnp_count += 1 if cnp?(appt)
end

if Flipper.enabled?(:appointments_consolidation, user)
filterer = AppointmentsPresentationFilter.new
appointments = appointments.keep_if { |appt| filterer.user_facing?(appt) }
end
filterer = AppointmentsPresentationFilter.new
appointments = appointments.keep_if { |appt| filterer.user_facing?(appt) }

# log count of C&P appointments in the appointments list, per GH#78141
log_cnp_appt_count(cnp_count) if cnp_count.positive?
Expand Down Expand Up @@ -234,6 +232,7 @@ def parse_possible_token_related_errors(e)
{ message:, status:, icn: sanitized_icn, context: }
end
end

# rubocop:enable Metrics/MethodLength

# Modifies the appointment, extracting individual fields from the appointment. This currently includes:
Expand Down
1 change: 0 additions & 1 deletion modules/vaos/spec/requests/vaos/v2/appointments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
allow(Settings.mhv).to receive(:facility_range).and_return([[1, 999]])
Flipper.enable('va_online_scheduling')
Flipper.disable(:va_online_scheduling_vaos_alternate_route)
Flipper.enable_actor('appointments_consolidation', current_user)
sign_in_as(current_user)
allow_any_instance_of(VAOS::UserService).to receive(:session).and_return('stubbed_token')
end
Expand Down
18 changes: 0 additions & 18 deletions modules/vaos/spec/services/v2/appointment_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@

before do
allow_any_instance_of(VAOS::UserService).to receive(:session).and_return('stubbed_token')
Flipper.enable_actor(:appointments_consolidation, user)
Flipper.disable(:va_online_scheduling_vaos_alternate_route)
end

Expand Down Expand Up @@ -441,23 +440,6 @@
end
end

context 'when requesting a list of appointments containing a booked cc appointment' do
it 'sets cancellable to false' do
Flipper.disable(:appointments_consolidation)
allow_any_instance_of(VAOS::V2::MobileFacilityService).to receive(:get_facility!).and_return(mock_facility2)
VCR.use_cassette('vaos/v2/appointments/get_appointments_200_cc_booked',
allow_playback_repeats: true, match_requests_on: %i[method path query], tag: :force_utf8) do
response = subject.get_appointments(start_date2, end_date2)
expect(response[:data][0][:kind]).to eq('cc')
expect(response[:data][0][:status]).to eq('booked')
expect(response[:data][0][:cancellable]).to eq(false)
expect(response[:data][1][:kind]).to eq('cc')
expect(response[:data][1][:status]).to eq('booked')
expect(response[:data][1][:cancellable]).to eq(false)
end
end
end

context 'when requesting a list of appointments containing proposed or cancelled cc appointments' do
it 'fetches provider info for a proposed cc appointment' do
allow_any_instance_of(VAOS::V2::MobileFacilityService).to receive(:get_facility!).and_return(mock_facility2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def mock_appointment(id: nil, created: nil, status: nil, start: nil, requested_p
expect(filterer.user_facing?(request)).to be false
end

it 'returns false if it was created more than a day from now' do
request[:created] = 2.days.from_now.to_s
it 'returns false if it was created more than 2 days from now' do
request[:created] = 3.days.from_now.to_s
expect(filterer.user_facing?(request)).to be false
end

Expand Down
Loading