Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
#129 Fixed how user symptoms are initially stored in the database
Browse files Browse the repository at this point in the history
  • Loading branch information
MilitsaB committed Mar 28, 2022
1 parent 551997f commit 763eb47
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/components/formLayout/FormLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function FormLayout({ changeState }: any) {
const [symptomsArray, setSymptomsArray] = useState<number[]>([]);
const [userAnswers, setUserAnswers] = useState<string[]>([]);
const [userSymptoms, setUserSymptoms] = useState<string[]>([]);
const date = new Date();
const navigate = useNavigate();

const users = firestore.collection('users');
Expand All @@ -33,14 +34,6 @@ export default function FormLayout({ changeState }: any) {
setUserAnswers([...userAnswers, childData]);
};

useEffect(() => {
if (symptomsDone) {
const symptomsAnswer = { label: "Patient's symptoms", result: userSymptoms };
addToUserAnswer(symptomsAnswer);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [symptomsDone, userSymptoms]);

const addSymptoms = (childSymptom: any, childPoint: number, symptomsStatus: boolean) => {
setSymptomsPoints(symptomsPoints + childPoint);
if (userSymptoms.length === 0) {
Expand Down Expand Up @@ -72,6 +65,7 @@ export default function FormLayout({ changeState }: any) {
basePoints: points - symptomsPoints,
assignedDoctor: 'requestedDoctor',
initialPatientHelpFormData: userAnswers,
patientSymptoms: [{ date, userSymptoms }],
})
.then(() => {
const getDoctor = Firebase.functions().httpsCallable('requestDoctor');
Expand Down

0 comments on commit 763eb47

Please sign in to comment.