Skip to content

Commit

Permalink
Merge branch 'main' into time-predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte authored Nov 1, 2023
2 parents d0da903 + a405018 commit eb86bd0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/slowzones/map/SlowZonesMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { SlowZonesLineName } from '../types';
import type { SegmentLabel, TooltipSide } from '../../../common/components/maps/LineMap';
import { getSlowZoneOpacity } from '../../../common/utils/slowZoneUtils';
import { useDelimitatedRoute } from '../../../common/utils/router';
import { TODAY_STRING } from '../../../common/constants/dates';
import { segmentSlowZones } from './segment';
import { SlowSegmentLabel } from './SlowSegmentLabel';
import { SlowZonesTooltip } from './SlowZonesTooltip';
Expand Down Expand Up @@ -106,7 +107,11 @@ export const SlowZonesMap: React.FC<SlowZonesMapProps> = ({
],
strokes: Object.entries(segment.slowZones).map(([direction, zones]) => {
const offset = direction === '0' ? 1 : -1;
const totalDelay = zones.reduce((sum, zone) => sum + zone.delay, 0);
const isToday = endDate === TODAY_STRING;
const totalDelay = zones.reduce(
(sum, zone) => sum + (isToday && zone.latest_delay ? zone.latest_delay : zone.delay),
0
);
return {
offset,
stroke: line.color,
Expand Down

0 comments on commit eb86bd0

Please sign in to comment.