diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Model/Payment.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/server/Model/Payment.hs b/src/server/Model/Payment.hs index 0db2f08..469f0d3 100644 --- a/src/server/Model/Payment.hs +++ b/src/server/Model/Payment.hs @@ -82,12 +82,11 @@ deleteOwnPayment user paymentId = do getTotalPayments :: Persist [TP.TotalPayment] getTotalPayments = do values <- select $ - from $ \(payment `InnerJoin` user) -> do - on (payment ^. PaymentUserId E.==. user ^. UserId) + from $ \payment -> do where_ (isNothing (payment ^. PaymentDeletedAt)) where_ (payment ^. PaymentFrequency E.==. val Punctual) groupBy (payment ^. PaymentUserId) - return (user ^. UserId, sum_ (payment ^. PaymentCost)) + return (payment ^. PaymentUserId, sum_ (payment ^. PaymentCost)) return $ catMaybes . map (getTotalPayment . unValueTuple) $ values getTotalPayment :: (UserId, Maybe Int) -> Maybe TP.TotalPayment |