Skip to content

Commit

Permalink
fix: sort ac agenda milo
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurlbrjc committed Aug 27, 2024
1 parent 6b26139 commit b07f9e4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions components/rdv/OngletAgendaEtablissement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ export default function OngletAgendaEtablissement({
dateDebut,
dateFin
)
const evenementsRecuperes = [...animationsCollectives]

if (peutAccederAuxSessions(conseiller)) {
const sessions = await recupererSessionsMilo(dateDebut, dateFin)
setEvenements([...sessions, ...animationsCollectives])
} else {
setEvenements([...animationsCollectives])
evenementsRecuperes.push(...sessions)
}

setEvenements(
evenementsRecuperes.toSorted(
(ac1, ac2) => ac1.date.toMillis() - ac2.date.toMillis()
)
)
} catch (e) {
setFailed(true)
} finally {
Expand Down

0 comments on commit b07f9e4

Please sign in to comment.