diff --git a/dashboard/src/components/ReceptionService.js b/dashboard/src/components/ReceptionService.js
index 10f52e351..b0518f68d 100644
--- a/dashboard/src/components/ReceptionService.js
+++ b/dashboard/src/components/ReceptionService.js
@@ -15,10 +15,11 @@ const ReceptionService = ({ report, team, dateString, dataTestIdPrefix = '', ser
useEffect(
// Init services for a team. We need to fetch services from legacy report and database and merge them.
function initServices() {
- console.log('init services');
+ console.log('INIT SERVICE FROM ReceptionService ?');
if (!dateString || !team?._id || dateString === 'undefined') {
return capture('Missing params for initServices in reception', { extra: { dateString, team, report } });
}
+ console.log('INIT SERVICE FROM ReceptionService ');
API.get({ path: `/service/team/${team._id}/date/${dateString}` }).then((res) => {
if (!res.ok) return toast.error();
const servicesFromLegacyReport = report?.services?.length ? JSON.parse(report?.services) : {};
@@ -33,7 +34,8 @@ const ReceptionService = ({ report, team, dateString, dataTestIdPrefix = '', ser
setServices(mergedServices);
});
},
- [dateString, report, team, organisation.services, setServices]
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [dateString, report, team]
);
const selectedServices = groupedServices.find((e) => e.groupTitle === selected)?.services || [];
diff --git a/dashboard/src/scenes/report/list.js b/dashboard/src/scenes/report/list.js
index de14a5e63..c311e2c01 100644
--- a/dashboard/src/scenes/report/list.js
+++ b/dashboard/src/scenes/report/list.js
@@ -51,8 +51,9 @@ const List = () => {
const [servicesCountByDay, setServicesCountByDay] = useState({});
useEffect(
- function fetchServicesStats() {
+ function fetchServicesCountByDay() {
if (!(viewAllOrganisationData ? allTeamIds : selectedTeamIds)?.length) return;
+ console.log('INIT SERVICE FROM fetchServicesCountByDay');
API.get({ path: `/service/team/${(viewAllOrganisationData ? allTeamIds : selectedTeamIds).join(',')}/month-stats/${startOfMonth}` }).then(
(res) => {
if (!res.ok) return toast.error("Erreur lors du chargement des statistiques des services de l'accueil");
diff --git a/dashboard/src/scenes/report/view.js b/dashboard/src/scenes/report/view.js
index eaa5c47b2..fd0dc0d8c 100644
--- a/dashboard/src/scenes/report/view.js
+++ b/dashboard/src/scenes/report/view.js
@@ -898,8 +898,10 @@ const Reception = ({ reports, selectedTeamsObject, dateString }) => {
function initServices() {
// Init services for a team. We need to fetch services from legacy report and database and merge them.
async function getServicesForTeam(team, report) {
- if (!dateString || !team || dateString === 'undefined')
+ if (!dateString || !team || dateString === 'undefined') {
return capture('Missing params for initServices in report', { extra: { dateString, team, report } });
+ }
+ console.log('INIT SERVICE FROM REPORT VIEW');
const res = await API.get({ path: `/service/team/${team}/date/${dateString}` });
if (!res.ok) return toast.error();
const servicesFromLegacyReport = report?.services?.length ? JSON.parse(report?.services) : {};
@@ -918,7 +920,8 @@ const Reception = ({ reports, selectedTeamsObject, dateString }) => {
setServices(results.reduce((acc, curr) => ({ ...acc, ...curr }), {}));
});
},
- [dateString, reports, organisation.services]
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [dateString, reports]
);
if (!organisation.receptionEnabled || !organisation?.services) return null;
diff --git a/dashboard/src/scenes/stats/Services.js b/dashboard/src/scenes/stats/Services.js
index 23c04219b..5c32e2881 100644
--- a/dashboard/src/scenes/stats/Services.js
+++ b/dashboard/src/scenes/stats/Services.js
@@ -25,6 +25,7 @@ const ServicesStats = ({ period, teamIds }) => {
setServicesFromDatabase({});
return;
}
+ console.log('INIT SERVICE FROM SERVICES STATS');
API.get({ path: `/service/team/${teamIds.join(',')}/stats`, query: startDate ? { from: startDate, to: endDate || startDate } : {} }).then(
(res) => {
if (!res.ok) return toast.error("Erreur lors du chargement des statistiques des services de l'accueil");