Skip to content

Commit

Permalink
Fix: Clearing Facilities Field Causes White Screen #8610 (#8629)
Browse files Browse the repository at this point in the history
Co-authored-by: Mohammed Nihal <[email protected]>
  • Loading branch information
AdityaJ2305 and nihal467 authored Sep 27, 2024
1 parent 38dc536 commit bbeab06
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Patient Consultation in multiple combination", () => {
const patientWeight = "70";
const patientHeight = "170";
const medicineOne = "DOLOLUP";
const patientIpNumber = Math.random().toString(36).substring(7);
const patientIpNumber = `${Math.floor(Math.random() * 90 + 10)}/${Math.floor(Math.random() * 9000 + 1000)}`;

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -94,7 +94,7 @@ describe("Patient Consultation in multiple combination", () => {
cy.submitButton("Create Consultation");
// the above submit should fail as IP number is missing
patientConsultationPage.typePatientNumber(patientIpNumber);
patientConsultationPage.selectBed("Dummy Bed 1");
patientConsultationPage.selectBed("Dummy Bed 6");
cy.submitButton("Create Consultation");
cy.verifyNotification("Consultation created successfully");
// Below code for the prescription module only present while creating a new consultation
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientPrescription.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PatientPage } from "../../pageobject/Patient/PatientCreation";
const patientPrescription = new PatientPrescription();
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const medicineNameOne = "DOLO";
const medicineNameOne = "AGCON";
const medicineNameTwo = "FDEP PLUS";
const medicineBaseDosage = "4";
const medicineTargetDosage = "9";
Expand Down
7 changes: 6 additions & 1 deletion src/Components/Users/UserAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ export const UserAdd = (props: UserProps) => {
}, [state.form.phone_number_is_whatsapp, state.form.phone_number]);

const setFacility = (selected: FacilityModel | FacilityModel[] | null) => {
setSelectedFacility(selected as FacilityModel[]);
const newSelectedFacilities = selected
? Array.isArray(selected)
? selected
: [selected]
: [];
setSelectedFacility(newSelectedFacilities as FacilityModel[]);
const form = { ...state.form };
form.facilities = selected
? (selected as FacilityModel[]).map((i) => i.id!)
Expand Down

0 comments on commit bbeab06

Please sign in to comment.