From 5c110716cfda6e616a795edd12f2012b132dca9f Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 2 Apr 2017 17:51:12 +0200 Subject: Add a chart on payments by month by categories --- src/client/Model/Income.elm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/client/Model/Income.elm') diff --git a/src/client/Model/Income.elm b/src/client/Model/Income.elm index 34578c6..aa5f05f 100644 --- a/src/client/Model/Income.elm +++ b/src/client/Model/Income.elm @@ -9,17 +9,16 @@ module Model.Income exposing , cumulativeIncomesSince ) +import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) -import Utils.Json as Json -import Time exposing (Time, hour) import List exposing (..) -import Dict exposing (Dict) +import Maybe.Extra as Maybe +import Time exposing (Time, hour) +import Utils.Json as Json import Model.Date exposing (timeDecoder) import Model.User exposing (UserId, userIdDecoder) -import Utils.Maybe as Maybe - type alias Incomes = Dict IncomeId Income type alias IncomeId = Int @@ -46,7 +45,7 @@ incomeDefinedForAll userIds incomes = let userIncomes = List.map (\userId -> List.filter ((==) userId << .userId) << Dict.values <| incomes) userIds firstIncomes = map (head << sortBy .time) userIncomes in if all Maybe.isJust firstIncomes - then head << reverse << List.sort << map .time << Maybe.cat <| firstIncomes + then head << reverse << List.sort << map .time << Maybe.values <| firstIncomes else Nothing userCumulativeIncomeSince : Time -> Time -> Incomes -> UserId -> Int -- cgit v1.2.3