diff options
author | Joris | 2016-06-26 12:31:24 +0200 |
---|---|---|
committer | Joris | 2016-06-26 12:31:24 +0200 |
commit | 9ec84e3a20c767f6525639f58cd22715e302b88d (patch) | |
tree | a080552859180707472c1a289080857c0a54fc06 /src/server/MonthlyPaymentJob.hs | |
parent | 5cb36652ccf07c9e0995ebc421a837ad7d258469 (diff) | |
download | budget-9ec84e3a20c767f6525639f58cd22715e302b88d.tar.gz budget-9ec84e3a20c767f6525639f58cd22715e302b88d.tar.bz2 budget-9ec84e3a20c767f6525639f58cd22715e302b88d.zip |
Add an editable date field for punctual payment creation
Diffstat (limited to 'src/server/MonthlyPaymentJob.hs')
-rw-r--r-- | src/server/MonthlyPaymentJob.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/server/MonthlyPaymentJob.hs b/src/server/MonthlyPaymentJob.hs index f5f6878..c4022c9 100644 --- a/src/server/MonthlyPaymentJob.hs +++ b/src/server/MonthlyPaymentJob.hs @@ -11,11 +11,11 @@ import Database.Persist (entityVal, insert) import Job (jobListener) import Model.Database -import Model.Payment (getMonthlyPayments) +import qualified Model.Payment as Payment import Model.JobKind import Model.Frequency -import Utils.Time (belongToCurrentMonth) +import Utils.Time (belongToCurrentMonth, timeToDay) monthlyPaymentJobListener :: IO () monthlyPaymentJobListener = @@ -26,7 +26,8 @@ monthlyPaymentJobListener = monthlyPaymentJob :: Persist () monthlyPaymentJob = do - monthlyPayments <- map entityVal <$> getMonthlyPayments + monthlyPayments <- map entityVal <$> Payment.listMonthly now <- liftIO $ getCurrentTime - let punctualPayments = map (\p -> p { paymentFrequency = Punctual, paymentCreation = now }) monthlyPayments + actualDay <- liftIO $ timeToDay now + let punctualPayments = map (\p -> p { paymentFrequency = Punctual, paymentDate = actualDay, paymentCreatedAt = now }) monthlyPayments sequence_ $ map insert punctualPayments |