From ad6f07b72f6697aa3d9bc0a95387ed1f231aa84f Mon Sep 17 00:00:00 2001 From: erinz Date: Fri, 14 Jul 2023 14:15:28 +0000 Subject: [PATCH 1/2] encounter fields only show up for one animal --- src/pages/reportSighting/ReportForm.jsx | 33 +++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/pages/reportSighting/ReportForm.jsx b/src/pages/reportSighting/ReportForm.jsx index 809d5758..090d703c 100644 --- a/src/pages/reportSighting/ReportForm.jsx +++ b/src/pages/reportSighting/ReportForm.jsx @@ -178,9 +178,10 @@ export default function ReportForm({ .map(data => ({ ...data, labelId: data.label })); const encountersRequired = encounterFieldSchemas .filter( - schema => schema.customField && schema.required && !customEncounterFormValues[schema.name], + schema => sightingType === 'one' && schema.customField && schema.required && !customEncounterFormValues[schema.name], ) .map(data => ({ ...data, labelId: data.label })); + console.log(sightingsRequired, encountersRequired); const requiredCustomFields = sightingsRequired.concat(encountersRequired); // check that required fields are complete. // specifiedTime field is required, but the logic and message @@ -368,20 +369,26 @@ export default function ReportForm({ categories={customSightingCategories} fieldSchema={requiredCustomSightingSchemas} /> - - )} + { + !optional && sightingType === 'one' && ( + <> + + + + ) + } {optional && ( <> From ece11f015643cd8ea417df9f20037fc2b5b8e847 Mon Sep 17 00:00:00 2001 From: erinz Date: Fri, 14 Jul 2023 14:36:56 +0000 Subject: [PATCH 2/2] remove logs --- src/pages/reportSighting/ReportForm.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/reportSighting/ReportForm.jsx b/src/pages/reportSighting/ReportForm.jsx index 090d703c..80c16d46 100644 --- a/src/pages/reportSighting/ReportForm.jsx +++ b/src/pages/reportSighting/ReportForm.jsx @@ -181,7 +181,6 @@ export default function ReportForm({ schema => sightingType === 'one' && schema.customField && schema.required && !customEncounterFormValues[schema.name], ) .map(data => ({ ...data, labelId: data.label })); - console.log(sightingsRequired, encountersRequired); const requiredCustomFields = sightingsRequired.concat(encountersRequired); // check that required fields are complete. // specifiedTime field is required, but the logic and message