Fix events not correctly filtered because of case sensitive (#478)

This commit is contained in:
lowlighter
2021-08-19 20:54:13 +02:00
parent d823e0fe26
commit c70b6493c0
2 changed files with 2 additions and 2 deletions

View File

@@ -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