diff --git a/mon-entreprise/scripts/fetch-stats.js b/mon-entreprise/scripts/fetch-stats.js
index 4aaac501f..496393072 100644
--- a/mon-entreprise/scripts/fetch-stats.js
+++ b/mon-entreprise/scripts/fetch-stats.js
@@ -193,6 +193,19 @@ async function fetchMonthlyVisits() {
return { pages, site }
}
+async function fetchUserAnswersStats() {
+ const ticketLists = await fetch(
+ 'https://mon-entreprise.zammad.com/api/v1/ticket_overviews?view=tickets_repondus_le_mois_dernier',
+ {
+ headers: new Headers({
+ Authorization: `Token token=${process.env.ZAMMAD_API_SECRET_KEY}`,
+ }),
+ }
+ )
+ const answer = await ticketLists.json()
+ return answer.index.count
+}
+
async function fetchUserFeedbackIssues() {
const tags = await fetch(
'https://mon-entreprise.zammad.com/api/v1/tag_list',
@@ -256,11 +269,13 @@ async function main() {
return satisfactionPage
})
const retoursUtilisateurs = await fetchUserFeedbackIssues()
+ const nbAnswersLast30days = await fetchUserAnswersStats()
writeInDataDir('stats.json', {
visitesJours,
visitesMois,
satisfaction,
retoursUtilisateurs,
+ nbAnswersLast30days,
})
} catch (e) {
console.error(e)
@@ -273,6 +288,7 @@ async function main() {
visitesMois: [],
satisfaction: [],
retoursUtilisateurs: [],
+ nbAnswersLast30days: 0,
})
}
}
diff --git a/mon-entreprise/source/pages/Stats/GlobalStats.tsx b/mon-entreprise/source/pages/Stats/GlobalStats.tsx
index a2b894436..8d781451f 100644
--- a/mon-entreprise/source/pages/Stats/GlobalStats.tsx
+++ b/mon-entreprise/source/pages/Stats/GlobalStats.tsx
@@ -1,5 +1,6 @@
import Emoji from 'Components/utils/Emoji'
import { useTranslation } from 'react-i18next'
+import { Link } from 'react-router-dom'
import { SatisfactionStyle } from './SatisfactionChart'
import { SatisfactionLevel, StatsStruct } from './types'
import { Indicator, Indicators } from './utils'
@@ -138,7 +139,6 @@ export default function GlobalStats({ stats }: { stats: StatsStruct }) {
return (
<>
- {' '}
+
+ Voir les demandes populaires
+
+ >
+ }
+ />