Skip to content

Commit 8229247

Browse files
committed
fix(gouvernance): if active is false we don't show person
1 parent 67a099d commit 8229247

File tree

1 file changed

+14
-5
lines changed
  • src/components/blocs/current-governance

1 file changed

+14
-5
lines changed

src/components/blocs/current-governance/index.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ const MANDATE_PRIORITY_THRESHOLD = 10;
1111

1212
export default function StructureCurrentGovernance() {
1313
const { id } = useUrl();
14-
const { data, isLoading, error } = useFetch(`/relations?filters[resourceId]=${id}&filters[relationTag]=${tag}&limit=500&sort=relationType.priority`);
14+
const { data, isLoading, error } = useFetch(
15+
`/relations?filters[resourceId]=${id}&filters[relationTag]=${tag}&limit=500&sort=relationType.priority`,
16+
);
1517

1618
if (!data?.data?.length > 0) return null;
1719
const currentMandates = data?.data
18-
.filter((mandate) => (!mandate.endDate || (mandate.endDate >= getComparableNow())))
19-
.filter((mandate) => (mandate?.relationType?.priority < MANDATE_PRIORITY_THRESHOLD));
20+
.filter(
21+
(mandate) => mandate.active !== false
22+
&& (!mandate.endDate || mandate.endDate >= getComparableNow()),
23+
)
24+
.filter(
25+
(mandate) => mandate?.relationType?.priority < MANDATE_PRIORITY_THRESHOLD,
26+
);
2027

2128
return (
2229
<Bloc
@@ -25,15 +32,17 @@ export default function StructureCurrentGovernance() {
2532
data={{ totalCount: currentMandates?.length || 0 }}
2633
hideOnEmptyView
2734
>
28-
<BlocTitle as="h3" look="h5">Gouvernance actuelle</BlocTitle>
35+
<BlocTitle as="h3" look="h5">
36+
Gouvernance actuelle
37+
</BlocTitle>
2938
<BlocContent>
3039
<Row gutters>
3140
{currentMandates.map((mandate) => (
3241
<Col key={mandate.id} n="12 md-6">
3342
<RelationCard relation={mandate} />
3443
</Col>
3544
))}
36-
{(currentMandates.length < data.data.length) && (
45+
{currentMandates.length < data.data.length && (
3746
<Col n="12 md-6">
3847
<GoToCard
3948
to={`/structures/${id}/gouvernance-et-referents`}

0 commit comments

Comments
 (0)