Skip to content

Commit

Permalink
fix condition evaluated as 0 instead of false
Browse files Browse the repository at this point in the history
  • Loading branch information
thoomasbro committed Jan 20, 2023
1 parent ffb9a6c commit ab162a1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/features/missions/MissionForm/ActionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function ActionCard({ action, duplicateAction, removeAction, selectAction
<ControlIcon />
<SummaryContent>
<Title>
Contrôle{action.actionNumberOfControls && action.actionNumberOfControls > 1 ? 's ' : ' '}
Contrôle{!!action.actionNumberOfControls && action.actionNumberOfControls > 1 ? 's ' : ' '}
{action.actionTheme ? (
<Accented>{`${action.actionTheme} ${
action.actionSubTheme ? ` - ${action.actionSubTheme}` : ''
Expand All @@ -53,19 +53,19 @@ export function ActionCard({ action, duplicateAction, removeAction, selectAction
'à renseigner'
)}
</Title>
{action.actionNumberOfControls && action.actionNumberOfControls > 0 && (
{!!action.actionNumberOfControls && action.actionNumberOfControls > 0 && (
<ControlSummary>
<Accented>{action.actionNumberOfControls}</Accented>
{` contrôle${action.actionNumberOfControls > 1 ? 's' : ''} réalisé${
action.actionNumberOfControls > 1 ? 's' : ''
} sur des cibles de type `}
<Accented>
{(action.actionTargetType && actionTargetTypeEnum[action.actionTargetType]?.libelle) ||
{(!!action.actionTargetType && actionTargetTypeEnum[action.actionTargetType]?.libelle) ||
'non spécifié'}
</Accented>
</ControlSummary>
)}
{action.actionNumberOfControls && action.actionNumberOfControls > 0 && (
{!!action.actionNumberOfControls && action.actionNumberOfControls > 0 && (
<ControlInfractionsTags
actionNumberOfControls={action.actionNumberOfControls}
infractions={action?.infractions}
Expand All @@ -88,7 +88,7 @@ export function ActionCard({ action, duplicateAction, removeAction, selectAction
'à renseigner'
)}
</Title>
{action.duration > 0 && (
{!!action.duration && action.duration > 0 && (
<DurationWrapper>
<Accented>{action.duration} heure(s)&nbsp;</Accented>
de surveillance
Expand Down

0 comments on commit ab162a1

Please sign in to comment.