fix(top-langs): fix fetching (#432, #403) (#435)

This commit is contained in:
Luigi Russo
2020-09-24 09:06:16 +02:00
committed by GitHub
parent 851bb7b4b8
commit 9c0e130a90
+1 -1
View File
@@ -53,7 +53,6 @@ async function fetchTopLanguages(username, langsCount = 5) {
})
// flatten the list of language nodes
.reduce((acc, curr) => curr.languages.edges.concat(acc), [])
.sort((a, b) => b.size - a.size)
.reduce((acc, prev) => {
// get the size of the language (bytes)
let langSize = prev.size;
@@ -75,6 +74,7 @@ async function fetchTopLanguages(username, langsCount = 5) {
}, {});
const topLangs = Object.keys(repoNodes)
.sort((a, b) => repoNodes[b].size - repoNodes[a].size)
.slice(0, langsCount)
.reduce((result, key) => {
result[key] = repoNodes[key];