Skip to content

Commit

Permalink
fix: fixed temporalConstraintsIds config - Ref gestion-de-projet#1286 (
Browse files Browse the repository at this point in the history
…#754)

* fix: fixed temporalConstraintsIds config - Ref gestion-de-projet#1286

* chore: upgrade release version

---------

Co-authored-by: Salah-BOUYAHIA <salah.bouyahia-ext@aphp.fr>
  • Loading branch information
ManelleG and Mehdi-BOUYAHIA authored Apr 18, 2023
1 parent 2d6927c commit 50aa5da
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cohort360_react",
"version": "2.21.1",
"version": "2.21.2",
"private": true,
"dependencies": {
"@apollo/client": "^3.7.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'
import { Button, Badge } from '@mui/material'
import { Button, Badge, Tooltip } from '@mui/material'

import { buildCohortCreation, deleteTemporalConstraint } from 'state/cohortCreation'
import { useAppSelector, useAppDispatch } from 'state'
Expand Down Expand Up @@ -89,16 +89,20 @@ const TemporalConstraint: React.FC = () => {
</Button>
</Badge>
) : (
<Button
onClick={handleOnClick}
className={classes.root}
style={{
backgroundColor: temporalConstraintExist && !disableTemporalConstraint ? '#FFE2A9' : '#DEDEDE'
}}
disabled={maintenanceIsActive || disableTemporalConstraint}
>
Contraintes temporelles
</Button>
<Tooltip title="Les contraintes temporelles ne peuvent être ajoutées que sur les critères simples du groupe ET principal, hors critères démographiques et d'IPP.">
<span>
<Button
onClick={handleOnClick}
className={classes.root}
style={{
backgroundColor: temporalConstraintExist && !disableTemporalConstraint ? '#FFE2A9' : '#DEDEDE'
}}
disabled={maintenanceIsActive || disableTemporalConstraint}
>
Contraintes temporelles
</Button>
</span>
</Tooltip>
)}

{modalIsOpen && <TemporalConstraintModal open={modalIsOpen} onClose={handleOnClose} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ const EventSequenceTable: React.FC<{ temporalConstraints: TemporalConstraintsTyp
</TableRow>
</TableHead>
<TableBody>
{!temporalConstraints || temporalConstraints.length === 0 ? (
{!temporalConstraints ||
temporalConstraints.filter((constraints) => !constraints.idList.includes('All' as never)).length === 0 ? (
<TableRow>
<TableCell colSpan={7}>
<Typography className={classes.loadingSpinnerContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const TemporalConstraintConfig: React.FC<{
const [noSelectedConstraintError, setNoSelectedConstraintError] = useState<boolean>(false)
const [incorrectTimingError, setIncorrectTimingError] = useState<boolean>(false)

const getSelectableCriteria = (firstCriteriaSelected: any) => {
const getSelectableCriteria = (firstCriteriaSelected: number | null) => {
const mainGroupCriteriaIds = criteriaGroup[0].criteriaIds

// remove criteria types that cannot be part of a temporal constraint
Expand All @@ -82,7 +82,9 @@ const TemporalConstraintConfig: React.FC<{
}, [] as number[])

// retrieves criteria that are not forbidden
const selectableCriteria = selectableCriteriaTypes.filter((criteria) => !forbiddenCriteriaIds.includes(criteria.id))
const selectableCriteria = selectableCriteriaTypes
.filter((criteria) => !forbiddenCriteriaIds.includes(criteria.id))
.filter((criteria) => criteria.id !== firstCriteriaSelected)

return selectableCriteria
}
Expand Down

0 comments on commit 50aa5da

Please sign in to comment.