diff --git a/CHANGELOG.md b/CHANGELOG.md index b3dcbf52d..acb20a5b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [27.106.2](https://github.com/SocialGouv/fce/compare/v27.106.1...v27.106.2) (2024-11-07) + + +### Bug Fixes + +* fix marche publiques sort ([#356](https://github.com/SocialGouv/fce/issues/356)) ([36f4ed5](https://github.com/SocialGouv/fce/commit/36f4ed5bc609d0264bbd23a73af08be2c643e8d2)) + ## [27.106.1](https://github.com/SocialGouv/fce/compare/v27.106.0...v27.106.1) (2024-10-14) diff --git a/package.json b/package.json index 42e8989b2..5449b9498 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fce", - "version": "27.106.1", + "version": "27.106.2", "description": "", "author": "commit42", "private": true, diff --git a/src/client/src/components/DataSheets/Sections/SharedComponents/NonBorderedTable/hooks.js b/src/client/src/components/DataSheets/Sections/SharedComponents/NonBorderedTable/hooks.js index f02743aef..f5798f24f 100644 --- a/src/client/src/components/DataSheets/Sections/SharedComponents/NonBorderedTable/hooks.js +++ b/src/client/src/components/DataSheets/Sections/SharedComponents/NonBorderedTable/hooks.js @@ -4,7 +4,6 @@ import { formatSiret } from "../../../../../helpers/utils"; import { formatUpperCase } from "../../../../../utils/entreprise/entreprise"; import { getCodePostal } from "../../../../../utils/establishment/establishment"; -// Suppose this function is imported or defined export const getCity = (marche) => marche?.etablissement?.libellecommuneetablissement || marche?.etablissement?.libellecommune2etablissement; @@ -25,22 +24,39 @@ export const useSortableData = (items, config = null) => { if (sortConfig.key === "city") { aValue = getCodePostal(a?.etablissement); // Retrieve city using getCity bValue = getCodePostal(b?.etablissement); - console.log(bValue); } else if (sortConfig.key === "acheteur") { aValue = getAcheteur(a); bValue = getAcheteur(b); + } else if ( + sortConfig.key === "montant" || + sortConfig.key === "dureeMois" + ) { + // Convertir 'montant' en nombre + aValue = parseFloat(a[sortConfig.key]); + bValue = parseFloat(b[sortConfig.key]); } else { aValue = a[sortConfig.key]; bValue = b[sortConfig.key]; } - if (aValue < bValue) { - return sortConfig.direction === "ascending" ? -1 : 1; - } - if (aValue > bValue) { - return sortConfig.direction === "ascending" ? 1 : -1; + // Gérer les valeurs nulles ou indéfinies + if (aValue == null) return 1; + if (bValue == null) return -1; + + // Comparaison appropriée en fonction du type + if (typeof aValue === "number" && typeof bValue === "number") { + return sortConfig.direction === "ascending" + ? aValue - bValue + : bValue - aValue; + } else { + if (aValue < bValue) { + return sortConfig.direction === "ascending" ? -1 : 1; + } + if (aValue > bValue) { + return sortConfig.direction === "ascending" ? 1 : -1; + } + return 0; } - return 0; }); } return sortableItems; diff --git a/src/client/src/components/PublicPage/Help/Help.js b/src/client/src/components/PublicPage/Help/Help.js index 2c10e112e..5816a2bdd 100644 --- a/src/client/src/components/PublicPage/Help/Help.js +++ b/src/client/src/components/PublicPage/Help/Help.js @@ -5,9 +5,11 @@ import React from "react"; import { Link } from "react-router-dom"; import UsersFeedback from "../../../containers/UsersFeedback"; +import Config from "../../../services/Config"; import LoadSpinner from "../../shared/LoadSpinner"; const Help = ({ pageData = null, isLoading, hasError }) => { + const strapiPath = Config.get("strapi.domain"); if (hasError) { return (
@@ -41,7 +43,10 @@ const Help = ({ pageData = null, isLoading, hasError }) => {
{item.titre}
{/* eslint-disable-next-line jsx-a11y/media-has-caption */}