From a405018b4fa18fbd1f9e3370bcb7e3bec2dd777f Mon Sep 17 00:00:00 2001 From: Devin Matte Date: Mon, 30 Oct 2023 21:17:56 -0400 Subject: [PATCH] Fixing color opacity on map for today (#888) --- modules/slowzones/map/SlowZonesMap.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/slowzones/map/SlowZonesMap.tsx b/modules/slowzones/map/SlowZonesMap.tsx index 18df154f1..96c804435 100644 --- a/modules/slowzones/map/SlowZonesMap.tsx +++ b/modules/slowzones/map/SlowZonesMap.tsx @@ -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'; @@ -106,7 +107,11 @@ export const SlowZonesMap: React.FC = ({ ], 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,