fix: remove case sensitive sort result
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m44s

This commit is contained in:
Thibaut Valentin 2026-01-02 15:58:59 +01:00
parent 6a7af8aea9
commit b54eaa2549
2 changed files with 14 additions and 11 deletions

View File

@ -46,7 +46,7 @@ function homePage() {
let content = document.createElement('div'); let content = document.createElement('div');
content.innerHTML = ` content.innerHTML = `
<ul> <ul>
<li><a onclick="setSubPage('poule')" href="javascript:void(0);">Par poule</a></li> <li><a onclick="setSubPage('poule')" href="javascript:void(0);">Par catégorie</a></li>
<li><a onclick="setSubPage('comb')" href="javascript:void(0);">Par combattant</a></li> <li><a onclick="setSubPage('comb')" href="javascript:void(0);">Par combattant</a></li>
<li><a onclick="setSubPage('club')" href="javascript:void(0);">Par club</a></li> <li><a onclick="setSubPage('club')" href="javascript:void(0);">Par club</a></li>
<li><a onclick="setSubPage('all')" href="javascript:void(0);">Tous les combattants</a></li> <li><a onclick="setSubPage('all')" href="javascript:void(0);">Tous les combattants</a></li>
@ -258,7 +258,7 @@ function poulePage(location) {
rootDiv.innerHTML = header + backButton; rootDiv.innerHTML = header + backButton;
const content = document.createElement('div'); const content = document.createElement('div');
content.style.marginTop = '1em'; content.style.marginTop = '1em';
content.innerHTML = '<h4>Recherche par poule</h4>'; content.innerHTML = '<h4>Recherche par catégorie</h4>';
const dataContainer = document.createElement('div'); const dataContainer = document.createElement('div');
dataContainer.id = 'data-container'; dataContainer.id = 'data-container';
@ -334,8 +334,8 @@ function poulePage(location) {
.then(poule => { .then(poule => {
const select = document.createElement('select'); const select = document.createElement('select');
select.setAttribute('id', poule.id); select.setAttribute('id', poule.id);
select.innerHTML = `<option value="0">--Sélectionner une poule--</option>`; select.innerHTML = `<option value="0">--Sélectionner une catégorie--</option>`;
for (const pouleKey of Object.keys(poule).sort()) { for (const pouleKey of Object.keys(poule).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))) {
select.innerHTML += `<option value="${poule[pouleKey]}">${pouleKey}</option>`; select.innerHTML += `<option value="${poule[pouleKey]}">${pouleKey}</option>`;
} }
select.addEventListener('change', e => { select.addEventListener('change', e => {
@ -356,7 +356,7 @@ function poulePage(location) {
loadPoule(); loadPoule();
} }
}) })
.catch(() => rootDiv.append(new Text("Erreur de chargement des poules"))) .catch(() => rootDiv.append(new Text("Erreur de chargement des catégories")))
.finally(() => stopLoading(loading)); .finally(() => stopLoading(loading));
rfFonction = () => { rfFonction = () => {

View File

@ -150,14 +150,15 @@ function CategoryList({uuid}) {
useEffect(() => { useEffect(() => {
if (data && Object.keys(data).length > 0) if (data && Object.keys(data).length > 0)
setCatId(data[Object.keys(data).sort()[0]]) setCatId(data[Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]])
}, [data]); }, [data]);
return <> return <>
{data ? <div className="input-group" style={{marginBottom: "1em"}}> {data ? <div className="input-group" style={{marginBottom: "1em"}}>
<h6 style={{margin: "auto 0.5em auto 0"}}>Catégorie</h6> <h6 style={{margin: "auto 0.5em auto 0"}}>Catégorie</h6>
<select className="form-select" aria-label="Select Result Type" onChange={e => setCatId(e.target.value)}> <select className="form-select" aria-label="Select Result Type" onChange={e => setCatId(e.target.value)}>
{Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)} {Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))
.map(key => <option key={key} value={data[key]}>{key}</option>)}
</select> </select>
</div> </div>
: error : error
@ -224,14 +225,15 @@ function ClubList({uuid}) {
useEffect(() => { useEffect(() => {
if (data && Object.keys(data).length > 0) if (data && Object.keys(data).length > 0)
setClubId(data[Object.keys(data).sort()[0]]) setClubId(data[Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]])
}, [data]); }, [data]);
return <> return <>
{data ? <div className="input-group" style={{marginBottom: "1em"}}> {data ? <div className="input-group" style={{marginBottom: "1em"}}>
<h6 style={{margin: "auto 0.5em auto 0"}}>Club</h6> <h6 style={{margin: "auto 0.5em auto 0"}}>Club</h6>
<select className="form-select" aria-label="Select Result Type" onChange={e => setClubId(e.target.value)}> <select className="form-select" aria-label="Select Result Type" onChange={e => setClubId(e.target.value)}>
{Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)} {Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))
.map(key => <option key={key} value={data[key]}>{key}</option>)}
</select> </select>
</div> </div>
: error : error
@ -310,14 +312,15 @@ function CombList({uuid}) {
useEffect(() => { useEffect(() => {
if (data && Object.keys(data).length > 0) if (data && Object.keys(data).length > 0)
setCombId(data[Object.keys(data).sort()[0]]) setCombId(data[Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]])
}, [data]); }, [data]);
return <> return <>
{data ? <div className="input-group" style={{marginBottom: "1em"}}> {data ? <div className="input-group" style={{marginBottom: "1em"}}>
<h6 style={{margin: "auto 0.5em auto 0"}}>Combattant</h6> <h6 style={{margin: "auto 0.5em auto 0"}}>Combattant</h6>
<select className="form-select" aria-label="Select Result Type" onChange={e => setCombId(e.target.value)}> <select className="form-select" aria-label="Select Result Type" onChange={e => setCombId(e.target.value)}>
{Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)} {Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))
.map(key => <option key={key} value={data[key]}>{key}</option>)}
</select> </select>
</div> </div>
: error : error