Skip to content

Commit

Permalink
removed useless sort call
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienR1 committed Feb 4, 2025
1 parent a66ba32 commit 4234d02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions packages/web/src/components/Calendar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/pages/horaire.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 4234d02

Please sign in to comment.