From 6cd1f39070b80dea5e1048a489dfa75d5a36baf9 Mon Sep 17 00:00:00 2001 From: Thomas Getgood Date: Sat, 21 Oct 2017 12:38:40 -0400 Subject: [PATCH] feat: return contributors sorted --- src/queries.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/queries.js b/src/queries.js index eae5f1a..29aa2fb 100644 --- a/src/queries.js +++ b/src/queries.js @@ -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, @@ -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),