Skip to content

Commit

Permalink
Fix: add default to NumWorkHours incase fetch fails (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
idamand authored Jul 25, 2024
1 parent 692c065 commit db9c466
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/[organisation]/kunder/[customer]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default async function Kunde({
)) ?? [];

const numWorkHours =
(await fetchWorkHoursPerWeek(params.organisation)) ?? 37.5;
(await fetchWorkHoursPerWeek(params.organisation)) || 37.5;

return (
<ConsultantFilterProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default async function Project({
const weekSpan = searchParams.weekSpan || undefined;

const numWorkHours =
(await fetchWorkHoursPerWeek(params.organisation)) ?? 37.5;
(await fetchWorkHoursPerWeek(params.organisation)) || 37.5;

const consultants =
(await fetchEmployeesWithImageAndToken(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/staffing/useConsultantsFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function getNumWorkHours(
},
);
const numWeeklyHours = await data.json();
setNumWorkHours(numWeeklyHours);
setNumWorkHours(numWeeklyHours || 37.5);
} catch (e) {
console.error("Error fetching number of weekly work hours", e);
}
Expand Down

0 comments on commit db9c466

Please sign in to comment.