∅:D[
3.1756] → [
4.25736:25937]
B:BD[
4.25736] → [
4.25736:25937]
B:BD[
4.25937] → [
2.145:213]
∅:D[
2.213] → [
4.26004:26177]
B:BD[
4.26004] → [
4.26004:26177]
B:BD[
4.26177] → [
6.876:969]
∅:D[
6.969] → [
4.26269:26357]
B:BD[
4.26269] → [
4.26269:26357]
toContributorRecord = \case
(CreditToUser uid', ws) -> do
(user, joinedOn') <-
fromMaybeT
(snapError 500 $ "No user record found for logged-in user.")
(mapMaybeT snapEval $ findUserProjectDetail uid' pid)
pure . Just . (uid',) $
Contributor
{ _userId = uid',
_handle = user ^. username,
_joinedOn = joinedOn',
_timeDevoted = Hours . (`div` 3600) . round . C.toSeconds' $ ws ^. wsLogged,
_revenueShare = ws ^. wsShare
}
_ -> pure Nothing
toContributorRecord uid' ws = do
(user, joinedOn') <- findUserProjectDetail uid' pid
pure $
Contributor
{ _userId = uid',
_handle = user ^. username,
_joinedOn = joinedOn',
_timeDevoted = Hours . (`div` 3600) . round . C.toSeconds' $ ws ^. wsLogged,
_revenueShare = ws ^. wsShare
}
findContributorPayouts (uid', h, t) = do
let userShares = M.lookup (CreditToUser uid') (p ^. creditToShares)
zeroContrib = Contributor uid' h t (Hours 0) 0
in (uid',) <$> maybe (pure zeroContrib) (toContributorRecord uid') userShares