From c70b6493c0526f13689b557aa96aa468d1a5c400 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Thu, 19 Aug 2021 20:54:13 +0200 Subject: [PATCH] Fix events not correctly filtered because of case sensitive (#478) --- source/plugins/habits/index.mjs | 2 +- source/plugins/languages/analyzers.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/plugins/habits/index.mjs b/source/plugins/habits/index.mjs index 7d40d743..658e386e 100644 --- a/source/plugins/habits/index.mjs +++ b/source/plugins/habits/index.mjs @@ -34,7 +34,7 @@ export default async function({login, data, rest, imports, q, account}, {enabled //Get user recent commits const commits = events .filter(({type}) => type === "PushEvent") - .filter(({actor}) => account === "organization" ? true : actor.login === login) + .filter(({actor}) => account === "organization" ? true : actor.login?.toLocaleLowerCase() === login.toLocaleLowerCase()) .filter(({created_at}) => new Date(created_at) > new Date(Date.now() - days * 24 * 60 * 60 * 1000)) console.debug(`metrics/compute/${login}/plugins > habits > filtered out ${commits.length} push events over last ${days} days`) habits.commits.fetched = commits.length diff --git a/source/plugins/languages/analyzers.mjs b/source/plugins/languages/analyzers.mjs index 0be1657a..3d6d2b5e 100644 --- a/source/plugins/languages/analyzers.mjs +++ b/source/plugins/languages/analyzers.mjs @@ -54,7 +54,7 @@ export async function recent({login, data, imports, rest, account}, {skipped = [ console.debug(`metrics/compute/${login}/plugins > languages > loading page ${page}`) commits.push(...(await rest.activity.listEventsForAuthenticatedUser({username:login, per_page:100, page})).data .filter(({type}) => type === "PushEvent") - .filter(({actor}) => account === "organization" ? true : actor.login === login) + .filter(({actor}) => account === "organization" ? true : actor.login?.toLocaleLowerCase() === login.toLocaleLowerCase()) .filter(({repo:{name:repo}}) => (!skipped.includes(repo.toLocaleLowerCase())) && (!skipped.includes(repo.toLocaleLowerCase().split("/").pop()))) .filter(({created_at}) => new Date(created_at) > new Date(Date.now() - days * 24 * 60 * 60 * 1000)) )