From 4234d02922b5ad84908177fe71ab3ead3571d2a6 Mon Sep 17 00:00:00 2001 From: Julien Rousseau Date: Tue, 4 Feb 2025 14:20:55 -0500 Subject: [PATCH] removed useless sort call --- packages/web/src/components/Calendar.astro | 13 ++++++------- packages/web/src/pages/horaire.astro | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/web/src/components/Calendar.astro b/packages/web/src/components/Calendar.astro index a626aed..c66978d 100644 --- a/packages/web/src/components/Calendar.astro +++ b/packages/web/src/components/Calendar.astro @@ -29,8 +29,8 @@ const activities = Astro.props.activities.map((w) => { if (overlap(previous, current)) { if (decimal(current.time.start) - decimal(previous.time.start) < 0.5) { - adjacents.add(current); adjacents.add(previous); + adjacents.add(current); } else { current.inset = previous.inset + 1; } @@ -40,12 +40,11 @@ const activities = Astro.props.activities.map((w) => { adjacents.size === adjacentCount || (adjacents.size > 0 && i === weekday.length - 1) ) { - [...adjacents] - .sort((a, b) => decimal(a.time.start) - decimal(b.time.start)) - .forEach( - (activity, position) => - (activity.adjacent = { position, count: adjacents.size }), - ); + let position = 0; + for (const activity of adjacents) { + activity.adjacent = { position, count: adjacents.size }; + position++; + } adjacents.clear(); } } diff --git a/packages/web/src/pages/horaire.astro b/packages/web/src/pages/horaire.astro index 5665280..6950648 100644 --- a/packages/web/src/pages/horaire.astro +++ b/packages/web/src/pages/horaire.astro @@ -61,7 +61,7 @@ const activities: Activity[][] = [ { type: 0, title: "activite 2", - time: { start: { hour: 13, minute: 15 }, end: { hour: 15, minute: 0 } }, + time: { start: { hour: 13, minute: 0 }, end: { hour: 15, minute: 0 } }, lessons: { count: 8, first: new Date(2025, 1, 6),