refactor(metrics/insights): new features (#1098)

This commit is contained in:
Simon Lecoq authored and GitHub committed 2022-06-24 16:35:09 -04:00
1 parent 79b80b1900
commit 3c4402e4ba
10 files changed
+732 -142

No files matched your search

+4 -1
View File
@@ -52,8 +52,11 @@ export default async function({login, q, imports, data, graphql, queries, accoun
for (const [key, value] of Object.entries(list))
list[key] = {value, percentage: value / reactions.length, score: value / (display === "relative" ? max : reactions.length)}
//Compute total reactions
const total = Object.values(list).map(({value}) => value).reduce((a, b) => a + b, 0)
//Results
return {list, comments: comments.length, details, days, twemoji: q["config.twemoji"]}
return {list, total, comments: comments.length, details, days, twemoji: q["config.twemoji"]}
}
//Handle errors
catch (error) {