From 40e58890f0b317dc878c060cc0aee9fbcce51b78 Mon Sep 17 00:00:00 2001 From: anvmn Date: Thu, 19 Sep 2024 22:44:37 +0300 Subject: [PATCH 1/4] Adjust display and logic [ci skip] --- .../src/elm/Pages/Prenatal/Activity/Model.elm | 2 +- .../elm/Pages/Prenatal/Activity/Update.elm | 20 +++++++++++++------ .../src/elm/Pages/Prenatal/Activity/View.elm | 15 +++++++++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/client/src/elm/Pages/Prenatal/Activity/Model.elm b/client/src/elm/Pages/Prenatal/Activity/Model.elm index e52e696897..68e36e354f 100644 --- a/client/src/elm/Pages/Prenatal/Activity/Model.elm +++ b/client/src/elm/Pages/Prenatal/Activity/Model.elm @@ -67,7 +67,7 @@ type Msg -- HistoryMsgs, OB, Step 1 | SetCurrentlyPregnant Bool | SetOBIntInput (Maybe Int -> ObstetricFormFirstStep -> ObstetricFormFirstStep) String - | SaveOBHistoryStep1 PersonId (Maybe ( ObstetricHistoryId, ObstetricHistory )) + | SaveOBHistoryStep1 Bool PersonId (Maybe ( ObstetricHistoryId, ObstetricHistory )) (Maybe HistoryTask) -- HistoryMsgs, OB, Step 2 | SetCSectionReason CSectionReason | SetNumberOfCSections String diff --git a/client/src/elm/Pages/Prenatal/Activity/Update.elm b/client/src/elm/Pages/Prenatal/Activity/Update.elm index ad71001e77..1c68a4fce2 100644 --- a/client/src/elm/Pages/Prenatal/Activity/Update.elm +++ b/client/src/elm/Pages/Prenatal/Activity/Update.elm @@ -356,7 +356,7 @@ update language currentDate id isLabTech db msg model = , [] ) - SaveOBHistoryStep1 personId saved -> + SaveOBHistoryStep1 skipSecondStep personId saved nextTask -> let measurementId = Maybe.map Tuple.first saved @@ -364,8 +364,18 @@ update language currentDate id isLabTech db msg model = measurement = getMeasurementValueFunc saved - ( appMsgs, updatedData ) = - ( model.historyData.obstetricFormFirstStep + ( extraMsgs, updatedData ) = + if skipSecondStep then + ( generateHistoryMsgs nextTask + , model.historyData + |> (\data -> { data | obstetricHistoryStep = ObstetricHistorySecondStep }) + ) + + else + ( [], model.historyData ) + + appMsgs = + model.historyData.obstetricFormFirstStep |> toObstetricHistoryValueWithDefault measurement |> Maybe.map (Backend.PrenatalEncounter.Model.SaveObstetricHistory personId measurementId @@ -374,14 +384,12 @@ update language currentDate id isLabTech db msg model = >> List.singleton ) |> Maybe.withDefault [] - , model.historyData - |> (\data -> { data | obstetricHistoryStep = ObstetricHistorySecondStep }) - ) in ( { model | historyData = updatedData } , Cmd.none , appMsgs ) + |> sequenceExtra (update language currentDate id isLabTech db) extraMsgs SetCSectionReason reason -> let diff --git a/client/src/elm/Pages/Prenatal/Activity/View.elm b/client/src/elm/Pages/Prenatal/Activity/View.elm index 4767591375..ef94ff501e 100644 --- a/client/src/elm/Pages/Prenatal/Activity/View.elm +++ b/client/src/elm/Pages/Prenatal/Activity/View.elm @@ -750,13 +750,26 @@ viewHistoryContent language currentDate assembled data = Obstetric -> case data.obstetricHistoryStep of ObstetricHistoryFirstStep -> + let + skipSecondStep = + nurseEncounterNotPerformed assembled + + label = + if skipSecondStep then + Translate.Save + + else + Translate.SaveAndNext + in [ customSaveButton language saveButtonActive (SaveOBHistoryStep1 + skipSecondStep assembled.participant.person assembled.measurements.obstetricHistory + nextTask ) - Translate.SaveAndNext + label ] ObstetricHistorySecondStep -> From ecc515d366572b97030eee0e740bff26c00ea410 Mon Sep 17 00:00:00 2001 From: anvmn Date: Thu, 19 Sep 2024 22:44:58 +0300 Subject: [PATCH 2/4] Properly determine if task is completed --- client/src/elm/Pages/Prenatal/Activity/Utils.elm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/elm/Pages/Prenatal/Activity/Utils.elm b/client/src/elm/Pages/Prenatal/Activity/Utils.elm index 2e81d9de8c..cfe321ea19 100644 --- a/client/src/elm/Pages/Prenatal/Activity/Utils.elm +++ b/client/src/elm/Pages/Prenatal/Activity/Utils.elm @@ -788,8 +788,12 @@ historyTaskCompleted : AssembledData -> HistoryTask -> Bool historyTaskCompleted assembled task = case task of Obstetric -> - isJust assembled.measurements.obstetricHistory - && isJust assembled.measurements.obstetricHistoryStep2 + if nurseEncounterNotPerformed assembled then + isJust assembled.measurements.obstetricHistory + + else + isJust assembled.measurements.obstetricHistory + && isJust assembled.measurements.obstetricHistoryStep2 Medical -> isJust assembled.measurements.medicalHistory From ee33bddcbf94f9a060c4ca459df8820e0de32dbb Mon Sep 17 00:00:00 2001 From: anvmn Date: Thu, 19 Sep 2024 23:08:31 +0300 Subject: [PATCH 3/4] Fixes --- .../elm/Pages/Prenatal/Activity/Update.elm | 6 +++-- .../src/elm/Pages/Prenatal/Activity/Utils.elm | 22 +++++++++++++++++-- .../src/elm/Pages/Prenatal/Activity/View.elm | 9 +++++--- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/client/src/elm/Pages/Prenatal/Activity/Update.elm b/client/src/elm/Pages/Prenatal/Activity/Update.elm index 1c68a4fce2..5f0ffb6221 100644 --- a/client/src/elm/Pages/Prenatal/Activity/Update.elm +++ b/client/src/elm/Pages/Prenatal/Activity/Update.elm @@ -368,11 +368,13 @@ update language currentDate id isLabTech db msg model = if skipSecondStep then ( generateHistoryMsgs nextTask , model.historyData - |> (\data -> { data | obstetricHistoryStep = ObstetricHistorySecondStep }) ) else - ( [], model.historyData ) + ( [] + , model.historyData + |> (\data -> { data | obstetricHistoryStep = ObstetricHistorySecondStep }) + ) appMsgs = model.historyData.obstetricFormFirstStep diff --git a/client/src/elm/Pages/Prenatal/Activity/Utils.elm b/client/src/elm/Pages/Prenatal/Activity/Utils.elm index cfe321ea19..21c7ce180c 100644 --- a/client/src/elm/Pages/Prenatal/Activity/Utils.elm +++ b/client/src/elm/Pages/Prenatal/Activity/Utils.elm @@ -40,7 +40,7 @@ import Measurement.Utils import Measurement.View exposing (viewActionTakenLabel) import Pages.Prenatal.Activity.Model exposing (..) import Pages.Prenatal.Activity.Types exposing (..) -import Pages.Prenatal.Encounter.Utils exposing (emergencyReferalRequired, getAllActivities) +import Pages.Prenatal.Encounter.Utils exposing (emergencyReferalRequired, generateGravida, generatePara, getAllActivities) import Pages.Prenatal.Model exposing (AssembledData, HealthEducationForm, PrenatalEncounterPhase(..), ReferralForm, VaccinationProgressDict) import Pages.Prenatal.Utils exposing (..) import Pages.Utils @@ -788,7 +788,11 @@ historyTaskCompleted : AssembledData -> HistoryTask -> Bool historyTaskCompleted assembled task = case task of Obstetric -> - if nurseEncounterNotPerformed assembled then + let + obstetricHistoryValue = + getMeasurementValueFunc assembled.measurements.obstetricHistory + in + if skipObstetricHistorySecondStep obstetricHistoryValue then isJust assembled.measurements.obstetricHistory else @@ -805,6 +809,20 @@ historyTaskCompleted assembled task = isJust assembled.measurements.outsideCare +skipObstetricHistorySecondStep : Maybe ObstetricHistoryValue -> Bool +skipObstetricHistorySecondStep obstetricHistoryValue = + let + gravida = + Maybe.map generateGravida obstetricHistoryValue + |> Maybe.withDefault "" + + para = + Maybe.map generatePara obstetricHistoryValue + |> Maybe.withDefault "" + in + gravida == "01" && para == "0000" + + resolveExaminationTasks : AssembledData -> List ExaminationTask resolveExaminationTasks assembled = let diff --git a/client/src/elm/Pages/Prenatal/Activity/View.elm b/client/src/elm/Pages/Prenatal/Activity/View.elm index ef94ff501e..5e16ddedf7 100644 --- a/client/src/elm/Pages/Prenatal/Activity/View.elm +++ b/client/src/elm/Pages/Prenatal/Activity/View.elm @@ -626,10 +626,12 @@ viewHistoryContent language currentDate assembled data = Maybe.andThen (\task -> Dict.get task tasksCompletedFromTotalDict) activeTask |> Maybe.withDefault ( 0, 0 ) - ( obstetricFormFirstStepInputs, obstetricFormFirstStepTasks ) = + obstetricFormFirstStep = getMeasurementValueFunc assembled.measurements.obstetricHistory |> obstetricHistoryFormWithDefault data.obstetricFormFirstStep - |> obstetricFormFirstStepInputsAndTasks language currentDate assembled + + ( obstetricFormFirstStepInputs, obstetricFormFirstStepTasks ) = + obstetricFormFirstStepInputsAndTasks language currentDate assembled obstetricFormFirstStep ( obstetricFormSecondStepInputs, obstetricFormSecondStepTasks ) = getMeasurementValueFunc assembled.measurements.obstetricHistoryStep2 @@ -752,7 +754,8 @@ viewHistoryContent language currentDate assembled data = ObstetricHistoryFirstStep -> let skipSecondStep = - nurseEncounterNotPerformed assembled + toObstetricHistoryValue obstetricFormFirstStep + |> skipObstetricHistorySecondStep label = if skipSecondStep then From c7bd192f8bdc0051c7dc977af02d8e1014270e15 Mon Sep 17 00:00:00 2001 From: anvmn Date: Sun, 22 Sep 2024 09:50:21 +0300 Subject: [PATCH 4/4] Increase Circle CI timeout --- ci-scripts/circleci_wait.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/circleci_wait.sh b/ci-scripts/circleci_wait.sh index 726fe9db8d..2b6f891274 100755 --- a/ci-scripts/circleci_wait.sh +++ b/ci-scripts/circleci_wait.sh @@ -3,7 +3,7 @@ CMD="$*" -TIMEOUT=3700 +TIMEOUT=4300 INTERVAL=240 $CMD & CMD_PID=$!