diff options
Diffstat (limited to 'front/src/Main.elm')
-rw-r--r-- | front/src/Main.elm | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/front/src/Main.elm b/front/src/Main.elm index ad8862b..57a6f11 100644 --- a/front/src/Main.elm +++ b/front/src/Main.elm @@ -358,7 +358,7 @@ periodicUpdateDecoder = type alias SimUpdates = { periodically : List PeriodicUpdate - , byMonth : List ( Int, List SimUpdate ) + , byMonth : List ( Int, SimUpdate ) } @@ -380,11 +380,7 @@ simUpdatesEncode { periodically, byMonth } = [ ( "periodically", JE.list periodicUpdateEncode periodically ) , ( "by_month" , JE.object <| - List.map - (\( m, us ) -> - ( String.fromInt m, JE.list simUpdateEncode us ) - ) - byMonth + List.map (\( m, us ) -> ( String.fromInt m, simUpdateEncode us )) byMonth ) ] @@ -394,7 +390,7 @@ simUpdatesDecoder = JD.map2 SimUpdates (JD.field "periodically" (JD.list periodicUpdateDecoder)) (JD.field "by_month" - (JD.keyValuePairs (JD.list simUpdateDecoder) + (JD.keyValuePairs simUpdateDecoder |> JD.map (\l -> List.map (\( k, v ) -> ( Maybe.withDefault 0 (String.toInt k), v )) l @@ -1093,7 +1089,7 @@ quotaView m { updates } { month, payed, pending_principal } = , div [] (List.map (simUpdateView [ class "bg-lime-200" ] m << .upd) monthUpdates.periodically ++ (List.map (simUpdateView [ class "bg-lime-200" ] m) <| - List.concatMap Tuple.second monthUpdates.byMonth + List.map Tuple.second monthUpdates.byMonth ) ) ) |