Skip to content

Instantly share code, notes, and snippets.

@nkaretnikov
Created May 21, 2015 18:39
Show Gist options
  • Save nkaretnikov/2931b3634f6501cbe0f5 to your computer and use it in GitHub Desktop.
Save nkaretnikov/2931b3634f6501cbe0f5 to your computer and use it in GitHub Desktop.
expected project balance
(old_shares, old_share_value, expected_share_value) <- testDB $ do
old_project_shares <- fetchProjectSharesDB project_id
old_user_shares <- getBy (UniquePledge user_id project_id) >>= \case
Nothing -> return 0
Just p -> return $ pledgeFundedShares $ entityVal p
return ( old_user_shares
, projectComputeShareValue old_project_shares
, projectComputeShareValue $
shares : delete old_user_shares old_project_shares )
let expected_project_balance =
accountBalance project_account
- (old_shares *$ old_share_value)
+ (shares *$ expected_share_value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment