diff --git a/src/fetchTopLanguages.js b/src/fetchTopLanguages.js
index ba8d64fdb9e3e..97c8152be6d3b 100644
--- a/src/fetchTopLanguages.js
+++ b/src/fetchTopLanguages.js
@@ -8,9 +8,10 @@ const fetcher = (variables, token) => {
query: `
query userInfo($login: String!) {
user(login: $login) {
- repositories(isFork: false, first: 100, orderBy: {field: UPDATED_AT, direction: DESC}) {
+ # fetch only owner repos & not forks
+ repositories(ownerAffiliations: OWNER, isFork: false, first: 100) {
nodes {
- languages(first: 1, orderBy: {field: SIZE, direction: DESC}) {
+ languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
edges {
size
node {
@@ -49,18 +50,13 @@ async function fetchTopLanguages(username) {
.filter((node) => {
return node.languages.edges.length > 0;
})
- .sort((a, b) => {
- return b.languages.edges[0].size - a.languages.edges[0].size;
- })
- .map((node) => {
- return node.languages.edges[0];
- })
+ .reduce((acc, curr) => curr.languages.edges.concat(acc), [])
+ .sort((a, b) => b.size - a.size)
.reduce((acc, prev) => {
let langSize = prev.size;
if (acc[prev.node.name] && prev.node.name === acc[prev.node.name].name) {
langSize = prev.size + acc[prev.node.name].size;
}
-
return {
...acc,
[prev.node.name]: {
diff --git a/src/renderTopLanguages.js b/src/renderTopLanguages.js
index e3c290cb7ef72..21594df7d2663 100644
--- a/src/renderTopLanguages.js
+++ b/src/renderTopLanguages.js
@@ -185,7 +185,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
${
hide_title
? ""
- : ``
+ : ``
}