On avance à petits pas

pull/1/head
Optimal Sup-Spé 3 years ago
parent a419391ccd
commit 92f0fe4b9e
  1. 35
      src/GenerateurH5P.elm

@ -1465,7 +1465,7 @@ h5pParser depth =
|> with contentField content |> with contentField content
|> BranchingScenarioH5P |> BranchingScenarioH5P
in in
succeed (R.map build << .content) succeed (R.map build << R.map L.reverse << .content)
|= branchingScenarioParser (depth + 1) |= branchingScenarioParser (depth + 1)
{ content = R.constant [] { content = R.constant []
, lastIdUsed = -1 , lastIdUsed = -1
@ -1548,13 +1548,13 @@ branchingScenarioParser depth state =
BranchingQuestionBranchingScenarioSubContext -> BranchingQuestionBranchingScenarioSubContext ->
inContext BranchingQuestionContext <| inContext BranchingQuestionContext <|
(succeed (succeed
(\newState -> (\subState ->
{ state { state
| content = | content =
R.map2 L.append R.map2 (++)
newState.content subState.content
state.content state.content
, lastIdUsed = state.lastIdUsed + 1 , lastIdUsed = subState.lastIdUsed
} }
) )
|= branchingQuestionParser (depth + 1) |= branchingQuestionParser (depth + 1)
@ -1593,7 +1593,10 @@ branchingScenarioParser depth state =
InteractiveVideoBranchingScenarioSubContext -> InteractiveVideoBranchingScenarioSubContext ->
inContext InteractiveVideoContext <| inContext InteractiveVideoContext <|
succeed state succeed
{ state
| lastIdUsed = state.lastIdUsed + 1
}
) )
) )
, let , let
@ -1612,7 +1615,6 @@ branchingScenarioParser depth state =
| content = | content =
state.content state.content
|> R.map changeLastId |> R.map changeLastId
|> R.map L.reverse
} }
] ]
@ -1663,12 +1665,14 @@ branchingQuestionParser depth state =
R.map branchingQuestionHelp UUID.generator R.map branchingQuestionHelp UUID.generator
branchingQuestionHelp uuid = branchingQuestionHelp uuid =
new contentField L.singleton
|> with3 typeField metadataField titleField "" (new contentField
|> with3 typeField metadataField contentTypeField "Branching Question" |> with3 typeField metadataField titleField ""
|> with2 typeField libraryField "H5P.BranchingQuestion 1.0" |> with3 typeField metadataField contentTypeField "Branching Question"
|> with2 typeField paramsField params |> with2 typeField libraryField "H5P.BranchingQuestion 1.0"
|> with2 typeField subContentIdField (UUID.toString uuid) |> with2 typeField paramsField params
|> with2 typeField subContentIdField (UUID.toString uuid)
)
params = params =
BranchingQuestionBranchingScenarioContentTypeParams BranchingQuestionBranchingScenarioContentTypeParams
@ -1677,12 +1681,11 @@ branchingQuestionParser depth state =
} }
content = content =
state.content R.map2 (++) state.content branchingQuestion
|> R.map2 (::) branchingQuestion
in in
succeed succeed
{ content = content { content = content
, lastIdUsed = state.lastIdUsed , lastIdUsed = state.lastIdUsed + 1
} }
] ]

Loading…
Cancel
Save