From 6b35a7421f7a3435e6b1f0cae07822b3e0875997 Mon Sep 17 00:00:00 2001 From: Alice Dahan Date: Tue, 5 Nov 2024 12:29:48 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20r=C3=A9activation=20de=20la=20connexion?= =?UTF-8?q?=20=C3=A0=20Crisp=20pour=20les=20stats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/scripts/stats/fetch-stats.js | 33 +++++++++++++------------------ 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/site/scripts/stats/fetch-stats.js b/site/scripts/stats/fetch-stats.js index 4cae4e4be..5f0dce90f 100644 --- a/site/scripts/stats/fetch-stats.js +++ b/site/scripts/stats/fetch-stats.js @@ -368,7 +368,6 @@ async function fetchCrispAnsweredConversationsLastMonth() { return conversations?.length ?? 0 } -// eslint-disable-next-line no-unused-vars async function fetchAllUserAnswerStats() { return await fetchCrispAnsweredConversationsLastMonth() } @@ -428,31 +427,28 @@ async function fetchCrispUserFeedbackIssues() { }) const issueCount = conversation?.reduce((acc, conversation) => { conversation.meta.segments - .filter((segment) => /#[\d]+/.exec(segment)) .forEach((issue) => { acc[issue] ??= 0 acc[issue] += 1 }) + return acc }, {}) return issueCount } -// eslint-disable-next-line no-unused-vars async function fetchAllUserFeedbackIssues() { const crispFeedbackIssues = await fetchCrispUserFeedbackIssues() - const allIssues = crispFeedbackIssues - .flatMap((issues) => Object.entries(issues)) - .reduce( - (acc, [issue, count]) => ({ - ...acc, - [issue]: (acc[issue] ?? 0) + count, - }), - {} - ) + const allIssues = Object.entries(crispFeedbackIssues).reduce( + (acc, [issue, count]) => ({ + ...acc, + [issue]: (acc[issue] ?? 0) + count, + }), + {} + ) const sortedIssues = await fetchGithubIssuesFromTags( Object.entries(allIssues) @@ -524,14 +520,14 @@ if ( visitesJours, visitesMois, rawSatisfaction, - // retoursUtilisateurs, - // nbAnswersLast30days, + retoursUtilisateurs, + nbAnswersLast30days, ] = await Promise.all([ fetchDailyVisits(), fetchMonthlyVisits(), fetchApi(buildSatisfactionQuery), - // fetchAllUserFeedbackIssues(), - // fetchAllUserAnswerStats(), + fetchAllUserFeedbackIssues(), + fetchAllUserAnswerStats(), ]) const satisfaction = uniformiseData(flattenPage(rawSatisfaction)).map( (page) => { @@ -552,8 +548,7 @@ if ( ]) ), satisfaction: mergePreviousData(baseData.satisfaction, satisfaction), - // We use old data because we don't have account on Zammad and Crisp anymore - retoursUtilisateurs: baseData.retoursUtilisateurs, - nbAnswersLast30days: baseData.nbAnswersLast30days, + retoursUtilisateurs, + nbAnswersLast30days, }) }