Skip to content

Commit

Permalink
feat: return contributors sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
tgetgood authored and RichardLitt committed Oct 23, 2017
1 parent adf2782 commit 6cd1f39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,13 @@ const depaginateAll = async (parent, {token, acc, type, key, query}) =>
count: 100
}))))

const byCount = (a, b) => b.count - a.count

/** Parse repository query result and filter for date range. */
const cleanRepo = async (token, result, before, after) => {
const tf = timeFilter(before, after)
const process = x => mergeContributions(users(tf(x)))
.sort(byCount)

const branches = await fetchAll({
token,
Expand Down Expand Up @@ -339,7 +342,8 @@ const cleanRepo = async (token, result, before, after) => {
}))

return {
commitAuthors: mergeContributions(users(commitAuthors)),
commitAuthors: mergeContributions(users(commitAuthors))
.sort(byCount),
commitCommentators: process(commitComments),
prCreators: process(prs),
prCommentators: process(prComments),
Expand Down

0 comments on commit 6cd1f39

Please sign in to comment.