Skip to content
Permalink
Browse files

Ensure actions in InputComposer are ordered by id

  • Loading branch information...
palas committed Mar 15, 2019
1 parent 3600a11 commit e2ac9379acd193d1c41f3f5a9e4b65782a253250
Showing with 6 additions and 4 deletions.
  1. +6 −4 meadow-client/src/Simulation.purs
@@ -233,7 +233,7 @@ inputComposer { inputs, choiceData, oracleData } =
ik = Set.fromFoldable (Map.keys inputs)
cdk = Set.fromFoldable (Map.keys choiceData)
people = Set.toUnfoldable (Set.union ik cdk) :: List Person
oracles = Map.toUnfoldable oracleData :: List (Tuple IdOracle OracleEntry)
oracles = Map.toAscUnfoldable oracleData :: List (Tuple IdOracle OracleEntry)

inputComposerPerson :: forall p. Person -> Map Person (List DetachedPrimitiveWIA)
-> Map Person (Map BigInteger Choice)
@@ -244,18 +244,20 @@ inputComposerPerson person inputs choices =
] ]
, case Map.lookup person inputs of
Nothing -> []
Just x -> Array.fromFoldable
do y <- x
Just x -> do y <- Array.sortWith (idActionFromDWAI) (Array.fromFoldable x)
case y of
DWAICommit idAction idCommit val tim ->
pure (inputCommit person idAction idCommit val tim)
DWAIPay idAction idCommit val ->
pure (inputPay person idAction idCommit val)
, case Map.lookup person choices of
Nothing -> []
Just x -> do (Tuple idChoice choice) <- Map.toUnfoldable x
Just x -> do (Tuple idChoice choice) <- Map.toAscUnfoldable x
pure (inputChoice person idChoice choice)
]
where
idActionFromDWAI (DWAICommit idAction _ _ _) = idAction
idActionFromDWAI (DWAIPay idAction _ _) = idAction

inputCommit :: forall p. Person -> IdAction -> IdCommit -> BigInteger -> Timeout
-> HTML p Query

0 comments on commit e2ac937

Please sign in to comment.
You can’t perform that action at this time.