Skip to content

Commit

Permalink
Remove CanceledAppointmentList and associated functionalities (#29383)
Browse files Browse the repository at this point in the history
* Remove CanceledAppointmentList and associated functions

* Remove unnecessary update
  • Loading branch information
JunTaoLuo committed Apr 29, 2024
1 parent e03beb1 commit df5c0e1
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 841 deletions.
Expand Up @@ -12,7 +12,6 @@ import {
} from '../../../redux/selectors';
import UpcomingAppointmentsList from '../UpcomingAppointmentsList';
import PastAppointmentsList from '../PastAppointmentsList';
import CanceledAppointmentsList from '../CanceledAppointmentsList';
import WarningNotification from '../../../components/WarningNotification';
import ScheduleNewAppointment from '../ScheduleNewAppointment';
import PageLayout from '../PageLayout';
Expand All @@ -28,32 +27,6 @@ import CernerAlert from '../../../components/CernerAlert';
// import CernerTransitionAlert from '../../../components/CernerTransitionAlert';
// import { selectPatientFacilities } from '~/platform/user/cerner-dsot/selectors';

const SUBPAGE_TITLES = {
upcoming: 'Your appointments',
requested: 'Requested',
past: 'Past appointments',
canceled: 'Canceled appointments',
};

function getSubPageTitleFromLocation(pathname) {
if (pathname.endsWith(SUBPAGE_TITLES.requested)) {
return SUBPAGE_TITLES.requested;
}

if (pathname.endsWith(SUBPAGE_TITLES.past)) {
return SUBPAGE_TITLES.past;
}
if (pathname.endsWith(SUBPAGE_TITLES.canceled)) {
return SUBPAGE_TITLES.canceled;
}

if (pathname.endsWith(SUBPAGE_TITLES.requested)) {
return SUBPAGE_TITLES.requested;
}

return SUBPAGE_TITLES.upcoming;
}

function renderWarningNotification() {
return (props, childContent) => {
const { status, description } = props;
Expand Down Expand Up @@ -84,8 +57,6 @@ export default function AppointmentsPage() {
// selectFeatureBookingExclusion(state),
// );

const subPageTitle = getSubPageTitleFromLocation(location.pathname);

let prefix = 'Your';
const isPending = location.pathname.endsWith('/pending');
const isPast = location.pathname.endsWith('/past');
Expand Down Expand Up @@ -125,13 +96,7 @@ export default function AppointmentsPage() {
scrollAndFocus('h1');
}
},
[
subPageTitle,
location.pathname,
prefix,
pageTitle,
featureBreadcrumbUrlUpdate,
],
[location.pathname, prefix, pageTitle, featureBreadcrumbUrlUpdate],
);

const [count, setCount] = useState(0);
Expand Down Expand Up @@ -190,9 +155,6 @@ export default function AppointmentsPage() {
<Route path="/past">
<PastAppointmentsList hasTypeChanged={hasTypeChanged} />
</Route>
<Route path="/canceled">
<CanceledAppointmentsList hasTypeChanged={hasTypeChanged} />
</Route>
</Switch>
</PageLayout>
);
Expand Down

This file was deleted.

29 changes: 0 additions & 29 deletions src/applications/vaos/appointment-list/redux/selectors.js
Expand Up @@ -18,7 +18,6 @@ import {
sortByDateAscending,
sortUpcoming,
groupAppointmentsByMonth,
isCanceledConfirmed,
isUpcomingAppointment,
sortByCreatedDateDescending,
isPendingOrCancelledRequest,
Expand Down Expand Up @@ -143,24 +142,6 @@ export const selectPastAppointments = createSelector(
},
);

export const selectCanceledAppointments = createSelector(
// Selecting pending here to pull in EC requests
state => state.appointments.pending,
state => state.appointments.confirmed,
(pending, confirmed) => {
if (!confirmed || !pending) {
return null;
}

const sortedAppointments = confirmed
.concat(pending)
.filter(isCanceledConfirmed)
.sort(sortByDateDescending);

return groupAppointmentsByMonth(sortedAppointments);
},
);

/*
* V2 Past appointments state selectors
*/
Expand Down Expand Up @@ -292,16 +273,6 @@ export function selectRequestedAppointmentDetails(state, id) {
};
}

export function getCanceledAppointmentListInfo(state) {
return {
appointmentsByMonth: selectCanceledAppointments(state),
facilityData: state.appointments.facilityData,
futureStatus: selectFutureStatus(state),
isCernerOnlyPatient: selectIsCernerOnlyPatient(state),
showScheduleButton: selectFeatureRequests(state),
};
}

export function getRequestedAppointmentListInfo(state) {
return {
facilityData: state.appointments.facilityData,
Expand Down
35 changes: 0 additions & 35 deletions src/applications/vaos/services/appointment/index.js
Expand Up @@ -373,41 +373,6 @@ export function isUpcomingAppointment(appt) {
return false;
}

/**
* Returns true if the given Appointment is a canceled confirmed appointment
*
* @export
* @param {Appointment} appt The FHIR Appointment to check
* @returns {boolean} Whether or not the appointment is a canceled
* appointment
*/
export function isCanceledConfirmed(appt) {
const today = moment();

if (CONFIRMED_APPOINTMENT_TYPES.has(appt.vaos?.appointmentType)) {
const apptDateTime = moment(appt.start);

return (
appt.status === APPOINTMENT_STATUS.cancelled &&
apptDateTime.isValid() &&
apptDateTime.isAfter(
today
.clone()
.startOf('day')
.subtract(30, 'days'),
) &&
apptDateTime.isBefore(
today
.clone()
.endOf('day')
.add(395, 'days'),
)
);
}

return false;
}

/**
* Sort method for past appointments
* @param {Appointment} a A FHIR appointment resource
Expand Down

0 comments on commit df5c0e1

Please sign in to comment.