Skip to content

Commit

Permalink
fix: suppression de l'indication sur le nombre d'organisme fermé (#3595)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Gaucher <[email protected]>
  • Loading branch information
Pomarom and Pomarom authored Mar 11, 2024
1 parent 3aaaff5 commit 89f654b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
9 changes: 1 addition & 8 deletions ui/hooks/organismes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,11 @@ export function useOrganismesFiltered(organismes: OrganismeNormalized[]) {
}

export function useOrganismesNormalizedLists(organismes: Organisme[]) {
const { organismesFiables, organismesACompleter, organismesNonRetenus, nbOrganismesFermes } = useMemo(() => {
const { organismesFiables, organismesACompleter, organismesNonRetenus } = useMemo(() => {
const organismesFiables: OrganismeNormalized[] = [];
const organismesACompleter: OrganismeNormalized[] = [];
const organismesNonRetenus: OrganismeNormalized[] = [];

let nbOrganismesFermes = 0;
(organismes || []).forEach((organisme: OrganismeNormalized) => {
// We need to memorize organismes with normalized names to be avoid running the normalization on each keystroke.
organisme.normalizedName = normalize(organisme.enseigne ?? organisme.raison_sociale ?? "");
Expand All @@ -127,29 +126,23 @@ export function useOrganismesNormalizedLists(organismes: Organisme[]) {
(organisme.ferme && !organisme.last_transmission_date) ||
(!organisme.enseigne && !organisme.raison_sociale)
) {
nbOrganismesFermes++;
organismesNonRetenus.push(organisme);
} else {
organismesACompleter.push(organisme);
if (organisme.ferme) {
nbOrganismesFermes++;
}
}
});

return {
organismesFiables,
organismesACompleter,
organismesNonRetenus,
nbOrganismesFermes,
};
}, [organismes]);

return {
organismesFiables,
organismesACompleter,
organismesNonRetenus,
nbOrganismesFermes,
};
}

Expand Down
21 changes: 4 additions & 17 deletions ui/modules/organismes/ListeOrganismesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ function ListeOrganismesPage(props: ListeOrganismesPageProps) {
const router = useRouter();
const { organisationType } = useAuth();

const title = `${props.modePublique ? "Ses" : "Mes"} organismes${
props.activeTab === "a-completer" ? " non fiables" : ""
}`;
const title = `${props.modePublique ? "Ses" : "Mes"} organismes${props.activeTab === "a-completer" ? " non fiables" : ""}`;

const { organismesFiables, organismesACompleter, organismesNonRetenus, nbOrganismesFermes } =
useOrganismesNormalizedLists(props.organismes);
const { organismesFiables, organismesACompleter, organismesNonRetenus } = useOrganismesNormalizedLists(
props.organismes
);

return (
<SimplePage title={title}>
Expand All @@ -86,18 +85,6 @@ function ListeOrganismesPage(props: ListeOrganismesPageProps) {
{organismesACompleter.length !== 0 && (
<ListItem>
les <strong>{organismesACompleter.length}</strong> établissements <strong>non-fiabilisés</strong>
{nbOrganismesFermes > 0 && (
<>
{" "}
dont <strong>{nbOrganismesFermes}</strong> établissement
{nbOrganismesFermes > 1 ? "s" : ""}{" "}
<strong>
fermé
{nbOrganismesFermes > 1 ? "s" : ""}
</strong>
.
</>
)}
</ListItem>
)}
</UnorderedList>
Expand Down

0 comments on commit 89f654b

Please sign in to comment.