Skip to content

Commit

Permalink
Fix crashing overview (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte committed Jun 25, 2024
1 parent fcd4bef commit bc56889
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/utils/array.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const indexByProperty = <T extends { [key: string]: any }>(
array: T[],
property: keyof T
) => {
): Record<string, T | undefined> => {
const res: Record<string, T> = {};
array.forEach((el) => {
res[el[property]] = el;
Expand Down
4 changes: 2 additions & 2 deletions modules/service/ServiceGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export const ServiceGraph: React.FC<ServiceGraphProps> = (props: ServiceGraphPro
data: allDates.map((date) => {
const scheduledToday = scheduledDataByDate[date];
const deliveredToday = deliveredDataByDate[date];
const anyDeliveredToday = deliveredToday?.miles_covered > 0;
const anyDeliveredToday = deliveredToday && deliveredToday.miles_covered > 0;
const value =
scheduledToday.count && anyDeliveredToday ? Math.round(scheduledToday.count) / 2 : 0;
scheduledToday?.count && anyDeliveredToday ? Math.round(scheduledToday?.count) / 2 : 0;
return { date, value };
}),
style: {
Expand Down

0 comments on commit bc56889

Please sign in to comment.