Skip to content

Commit

Permalink
Fix missing values in KM Editor preview save values
Browse files Browse the repository at this point in the history
  • Loading branch information
janslifka committed Jan 20, 2025
1 parent c2991f1 commit 9524310
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions engine-shared/elm/Shared/Data/QuestionnaireQuestionnaire.elm
Original file line number Diff line number Diff line change
Expand Up @@ -802,15 +802,27 @@ generateReplies currentTime seed questionUuid km questionnaireDetail =
( newSeed, mbChapterUuid, replies ) =
foldReplies currentTime km parentMap seed questionUuid Dict.empty

originalReplies =
questionnaireDetail.replies
reply =
findReplyBySuffix questionUuid replies

newReplies =
if Maybe.isJust reply then
questionnaireDetail.replies

else
Dict.union replies questionnaireDetail.replies
in
( newSeed
, mbChapterUuid
, { questionnaireDetail | replies = Dict.union replies originalReplies }
, { questionnaireDetail | replies = newReplies }
)


findReplyBySuffix : String -> Dict String Reply -> Maybe ( String, Reply )
findReplyBySuffix suffix replies =
Dict.find (\key _ -> String.endsWith suffix key) replies


foldReplies : Time.Posix -> KnowledgeModel -> KnowledgeModel.ParentMap -> Seed -> String -> Dict String Reply -> ( Seed, Maybe String, Dict String Reply )
foldReplies currentTime km parentMap seed questionUuid replies =
let
Expand Down

0 comments on commit 9524310

Please sign in to comment.