Skip to content

Commit

Permalink
fix(gouvernance): if active is false we don't show person
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Oct 11, 2024
1 parent 67a099d commit 8229247
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/components/blocs/current-governance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ const MANDATE_PRIORITY_THRESHOLD = 10;

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

if (!data?.data?.length > 0) return null;
const currentMandates = data?.data
.filter((mandate) => (!mandate.endDate || (mandate.endDate >= getComparableNow())))
.filter((mandate) => (mandate?.relationType?.priority < MANDATE_PRIORITY_THRESHOLD));
.filter(
(mandate) => mandate.active !== false
&& (!mandate.endDate || mandate.endDate >= getComparableNow()),
)
.filter(
(mandate) => mandate?.relationType?.priority < MANDATE_PRIORITY_THRESHOLD,
);

return (
<Bloc
Expand All @@ -25,15 +32,17 @@ export default function StructureCurrentGovernance() {
data={{ totalCount: currentMandates?.length || 0 }}
hideOnEmptyView
>
<BlocTitle as="h3" look="h5">Gouvernance actuelle</BlocTitle>
<BlocTitle as="h3" look="h5">
Gouvernance actuelle
</BlocTitle>
<BlocContent>
<Row gutters>
{currentMandates.map((mandate) => (
<Col key={mandate.id} n="12 md-6">
<RelationCard relation={mandate} />
</Col>
))}
{(currentMandates.length < data.data.length) && (
{currentMandates.length < data.data.length && (
<Col n="12 md-6">
<GoToCard
to={`/structures/${id}/gouvernance-et-referents`}
Expand Down

0 comments on commit 8229247

Please sign in to comment.