Skip to content

Commit

Permalink
Filter rsv devices on test card
Browse files Browse the repository at this point in the history
  • Loading branch information
mpbrown committed Oct 23, 2023
1 parent 737d4e9 commit 49cb874
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions frontend/src/app/testQueue/TestCardForm/TestCardForm.utils.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import moment from "moment/moment";
import { useFeature } from "flagged";

import { DevicesMap, QueriedFacility, QueriedTestOrder } from "../QueueItem";
import { displayFullName } from "../../utils";
Expand All @@ -11,6 +12,7 @@ import {
SomeoneWithName,
} from "../constants";
import { showError, showSuccess } from "../../utils/srToast";
import { filterRsvFromAllDevices } from "../../utils/rsvHelper";

import { TestFormState } from "./TestCardFormReducer";
import { parseSymptoms } from "./diseaseSpecificComponents/CovidAoEForm";
Expand All @@ -37,12 +39,17 @@ export function useDeviceTypeOptions(
facility: QueriedFacility,
state: TestFormState
) {
let deviceTypeOptions = [...facility!.deviceTypes]
.sort(alphabetizeByName)
.map((d) => ({
label: d.name,
value: d.internalId,
}));
const singleEntryRsvEnabled = useFeature("singleEntryRsvEnabled");

let deviceTypes = [...facility!.deviceTypes];
if (!singleEntryRsvEnabled) {
deviceTypes = filterRsvFromAllDevices(deviceTypes);
}

let deviceTypeOptions = [...deviceTypes].sort(alphabetizeByName).map((d) => ({
label: d.name,
value: d.internalId,
}));

const deviceTypeIsInvalid = !state.devicesMap.has(state.deviceId);

Expand Down

0 comments on commit 49cb874

Please sign in to comment.