Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dgboss committed Sep 12, 2024
1 parent 47f60f9 commit 26fbecd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions web/src/features/fba/components/infoPanel/AdvisoryText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSelector } from 'react-redux'
import { selectProvincialSummary } from 'features/fba/slices/provincialSummarySlice'
import { selectFireCentreHFIFuelStats } from '@/app/rootReducer'
import { AdvisoryStatus } from 'utils/constants'
import { isEmpty, isUndefined } from 'lodash'
import { isEmpty, isNil, isUndefined, take } from 'lodash'
import { calculateStatusText } from '@/features/fba/calculateZoneStatus'

interface AdvisoryTextProps {
Expand Down Expand Up @@ -56,10 +56,7 @@ const AdvisoryText = ({
const allZoneUnitFuelStats = fireCentreHFIFuelStats?.[selectedFireCenter.name]
const selectedZoneUnitFuelStats = allZoneUnitFuelStats?.[selectedFireZoneUnit.fire_shape_id] ?? []
const sortedFuelStats = [...selectedZoneUnitFuelStats].sort(sortByArea)
let topFuels: FireZoneFuelStats[] = []
for (let i = 0; i < 3 && i < sortedFuelStats.length; i++) {
topFuels.push(sortedFuelStats[i])
}
let topFuels = take(sortedFuelStats, 3)
setSelectedFireZoneUnitTopFuels(topFuels)
}, [fireCentreHFIFuelStats])

Expand Down Expand Up @@ -115,8 +112,7 @@ const AdvisoryText = ({
const fireCenterSummary = provincialSummary[selectedFireCenter!.name]
const fireZoneUnitInfos = fireCenterSummary?.filter(fc => fc.fire_shape_id === selectedFireZoneUnit?.fire_shape_id)
const zoneStatus = calculateStatusText(fireZoneUnitInfos, advisoryThreshold)
const hasCriticalHours =
!isUndefined(minStartTime) && !isUndefined(maxEndTime) && selectFireCentreHFIFuelStats.length > 0
const hasCriticalHours = !isNil(minStartTime) && !isNil(maxEndTime) && selectFireCentreHFIFuelStats.length > 0
let message = ''
if (hasCriticalHours) {
message = `There is a fire behaviour ${zoneStatus} in effect for ${selectedFireZoneUnit?.mof_fire_zone_name} between ${minStartTime}:00 and ${maxEndTime}:00 for ${getTopFuelsString()}.`
Expand Down

0 comments on commit 26fbecd

Please sign in to comment.