Skip to content

Commit

Permalink
fix: now most used languages are truncated to a limit of two (#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
OgDev-01 authored Dec 5, 2023
1 parent 6643c20 commit 97ce66e
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ function getLastContributedRepo(pullRequests: DbRepoPR[]) {
function getTopContributorLanguages(contributor: DbUser) {
// some contributors will have empty language objects so we will pull their popular language from the interests field instead of defaulting to nothing
const entries = Object.entries<string>(contributor.languages);
if (entries.length === 0) {
return [contributor.interests];
}
return entries

return (entries.length === 0 ? contributor.interests.split(",") : entries)
.sort(([, a], [, b]) => (a < b ? -1 : 1))
.slice(0, 2)
.map(([language]) => language);
Expand Down

0 comments on commit 97ce66e

Please sign in to comment.