Skip to content

Commit

Permalink
Don't show TPI stats if they're all zero (#3869)
Browse files Browse the repository at this point in the history
  • Loading branch information
conbrad authored Aug 21, 2024
1 parent 4be25e9 commit f5d63d9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const FireZoneUnitSummary = ({
<FuelSummary selectedFireZoneUnit={selectedFireZoneUnit} fuelTypeInfo={fuelTypeInfo} />
</Grid>
<Grid item sx={{ width: '95%' }}>
{ isNull(fireZoneTPIStats) ? (
{ isNull(fireZoneTPIStats) || fireZoneTPIStats.valley_bottom + fireZoneTPIStats.mid_slope + fireZoneTPIStats.upper_slope === 0 ? (
<Typography>
No elevation information available.
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,27 @@ describe('FireZoneUnitSummary', () => {
const fireZoneUnitInfo = getByTestId('elevation-status')
expect(fireZoneUnitInfo).toBeInTheDocument()
})

it('should not render TPI stats all zero', () => {
const fireShape: FireShape = {
fire_shape_id: 1,
mof_fire_zone_name: 'foo',
mof_fire_centre_name: 'fizz',
area_sqm: 10
}
const { queryByTestId } = render(
<FireZoneUnitSummary
fuelTypeInfo={[]}
fireZoneTPIStats={{
fire_zone_id: 0,
valley_bottom: 0,
mid_slope: 0,
upper_slope: 0
}}
selectedFireZoneUnit={fireShape}
/>
)
const fireZoneUnitInfo = queryByTestId('elevation-status')
expect(fireZoneUnitInfo).not.toBeInTheDocument()
})
})

0 comments on commit f5d63d9

Please sign in to comment.