Skip to content

Commit

Permalink
include empty collection
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed Nov 28, 2024
1 parent 19f3917 commit 58c0c10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Deal/DealBase.hs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,12 @@ getAllCollectedFrame t mPid =
Just pids -> Map.filterWithKey (\k _ -> k `elem` pids) mCf -- `debug` ("Just when collecting cfs"++show mCf)

getLatestCollectFrame :: Ast.Asset a => TestDeal a -> Maybe [PoolId] -> Map.Map PoolId (Maybe CF.TsRow)
getLatestCollectFrame t mPns = Map.map (last . view CF.cashflowTxn <$>) (getAllCollectedFrame t mPns)
getLatestCollectFrame t mPns = Map.map (\case
Nothing -> Nothing
(Just (CF.CashFlowFrame (_,_,_) [])) -> Nothing
(Just (CF.CashFlowFrame (_,_,_) txns)) -> Just $ last txns
)
(getAllCollectedFrame t mPns)

getAllCollectedTxns :: Ast.Asset a => TestDeal a -> Maybe [PoolId] -> Map.Map PoolId (Maybe [CF.TsRow])
getAllCollectedTxns t mPns = Map.map (view CF.cashflowTxn <$>) (getAllCollectedFrame t mPns)
Expand Down

0 comments on commit 58c0c10

Please sign in to comment.