diff options
author | Joris | 2020-05-30 15:02:24 +0200 |
---|---|---|
committer | Joris | 2020-05-30 15:02:26 +0200 |
commit | 706635ed16266962de75f15a83453cfa1b1bab83 (patch) | |
tree | a8e2a5e8bb58f8f765751ec0608781f67cbb940b /server/src/Job | |
parent | 80d0a1f5207378f80e7c851fba13396b6f78f785 (diff) |
Compute cumulative income until now
Previously, last payment date was used to compute the cumulative income.
It resulted in big differences of cumulative incomes, if no payment have
been added for some days.
Diffstat (limited to 'server/src/Job')
-rw-r--r-- | server/src/Job/WeeklyReport.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/src/Job/WeeklyReport.hs b/server/src/Job/WeeklyReport.hs index ff80ddf..282f2f1 100644 --- a/server/src/Job/WeeklyReport.hs +++ b/server/src/Job/WeeklyReport.hs @@ -3,6 +3,7 @@ module Job.WeeklyReport ) where import qualified Data.Map as M +import qualified Data.Time.Clock as Clock import Data.Time.Clock (UTCTime, getCurrentTime) import Common.Model (User (..)) @@ -30,8 +31,8 @@ weeklyReport conf mbLastExecution = do incomeDefinedForAll <- IncomePersistence.definedForAll (_user_id <$> users) cumulativeIncome <- case (incomeDefinedForAll, paymentRange) of - (Just incomeStart, Just (paymentStart, paymentEnd)) -> - IncomePersistence.getCumulativeIncome (max incomeStart paymentStart) paymentEnd + (Just incomeStart, Just (paymentStart, _)) -> + IncomePersistence.getCumulativeIncome (max incomeStart paymentStart) (Clock.utctDay now) _ -> return M.empty |