Show all project contributors, not just those with a revenue share.

[?]
Feb 14, 2021, 12:59 AM
ZEAH247RECTEYICYRFRX574BZWZYVGFWETVVKDCAPTKIGRYQT4IQC

Dependencies

  • [2] RKY3XCSI Get the correct contributor data.
  • [3] XXJFUZOV Add first revenue date to project payout computation.
  • [4] W3PIWHDK Fix logged hours display error.
  • [5] 4354Y4PE Add endpoint to list project contributors.
  • [6] U7YAT2ZK Add error reporting to signup form.
  • [*] PBD7LZYQ Postgres & auth are beginning to function.

Change contents

  • edit in server/Aftok/Snaplet/Projects.hs at line 115
    [4.25643]
    [4.25643]
    contributors <- snapEval $ listProjectContributors pid uid
  • replacement in server/Aftok/Snaplet/Projects.hs at line 118
    [3.1756][4.25736:25937](),[4.25736][4.25736:25937](),[4.25937][2.145:213](),[2.213][4.26004:26177](),[4.26004][4.26004:26177](),[4.26177][4.876:969](),[4.969][4.26269:26357](),[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
    [3.1756]
    [4.26357]
    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
  • replacement in server/Aftok/Snaplet/Projects.hs at line 135
    [4.26381][4.26381:26491]()
    fmap (M.fromList . catMaybes)
    . traverse toContributorRecord
    $ M.assocs (p ^. creditToShares)
    [4.26381]
    [4.26491]
    fromMaybeT
    (snapError 500 $ "No user record found for credited user.")
    . mapMaybeT snapEval
    . fmap M.fromList
    $ traverse findContributorPayouts contributors