Skip to content

Commit

Permalink
fix(frontend): generate correct arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Nov 28, 2024
1 parent d1401b6 commit 29d244a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/frontend/app/routes/_dashboard.fitness.analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const ExercisesChart = () => {
);
};

const hourTuples = Array.from({ length: 12 }, (_, i) => [i * 2, i * 2 + 1]);
const hourTuples = Array.from({ length: 12 }, (_, i) => [i * 2, i * 2 + 2]);

const TimeOfDayChart = () => {
const loaderData = useLoaderData<typeof loader>();
Expand All @@ -230,13 +230,13 @@ const TimeOfDayChart = () => {
})),
(item) =>
hourTuples.find(
([start, end]) => item.hour >= start && item.hour <= end,
([start, end]) => item.hour >= start && item.hour < end,
),
),
).map(([hour, values]) => {
const grouped = hour.split(",").map(Number);
const unGrouped = hour.split(",").map(Number);
return {
hour: { from: grouped[0], to: grouped[1] + 1 },
hour: { from: unGrouped[0], to: unGrouped[1] },
count: values.reduce((acc, val) => acc + val.count, 0),
};
});
Expand Down

0 comments on commit 29d244a

Please sign in to comment.