diff --git a/api/top-langs.js b/api/top-langs.js index d01c90eea0ef2..cde0a9af08a93 100644 --- a/api/top-langs.js +++ b/api/top-langs.js @@ -25,8 +25,8 @@ export default async (req, res) => { layout, langs_count, exclude_repo, - p, - q, + size_weight, + count_weight, custom_title, locale, border_radius, @@ -48,8 +48,8 @@ export default async (req, res) => { const topLangs = await fetchTopLanguages( username, parseArray(exclude_repo), - p, - q, + size_weight, + count_weight, ); const cacheSeconds = clampValue( diff --git a/src/fetchers/top-languages-fetcher.js b/src/fetchers/top-languages-fetcher.js index 235e3c66bd38d..45b2ba7d85183 100644 --- a/src/fetchers/top-languages-fetcher.js +++ b/src/fetchers/top-languages-fetcher.js @@ -54,7 +54,12 @@ const fetcher = (variables, token) => { * @param {string[]} exclude_repo List of repositories to exclude. * @returns {Promise} Top languages data. */ -const fetchTopLanguages = async (username, exclude_repo = [], p = 1, q = 0) => { +const fetchTopLanguages = async ( + username, + exclude_repo = [], + size_weight = 1, + count_weight = 0, +) => { if (!username) throw new MissingParamError(["username"]); const res = await retryer(fetcher, { login: username }); @@ -136,7 +141,8 @@ const fetchTopLanguages = async (username, exclude_repo = [], p = 1, q = 0) => { Object.keys(repoNodes).forEach((name) => { // comparison index calculation repoNodes[name].size = - Math.pow(repoNodes[name].size, p) * Math.pow(repoNodes[name].count, q); + Math.pow(repoNodes[name].size, size_weight) * + Math.pow(repoNodes[name].count, count_weight); }); const topLangs = Object.keys(repoNodes)