Compare commits

..

No commits in common. "b54eaa2549bbedee49cc1e72c8c77f91835daa11" and "6d6324e1b48a6b2c7820522ee039ef2df6b629f6" have entirely different histories.

4 changed files with 24 additions and 22 deletions

View File

@ -229,10 +229,7 @@ public class ResultService {
private void getTree(List<TreeModel> treeModels, MembreModel membreModel, ResultCategoryData out) { private void getTree(List<TreeModel> treeModels, MembreModel membreModel, ResultCategoryData out) {
ArrayList<TreeNode<ResultCategoryData.TreeData>> trees = new ArrayList<>(); ArrayList<TreeNode<ResultCategoryData.TreeData>> trees = new ArrayList<>();
treeModels.stream() treeModels.stream().filter(t -> t.getLevel() != 0).forEach(treeModel -> {
.filter(t -> t.getLevel() != 0)
.sorted(Comparator.comparing(TreeModel::getLevel))
.forEach(treeModel -> {
TreeNode<ResultCategoryData.TreeData> root = new TreeNode<>(); TreeNode<ResultCategoryData.TreeData> root = new TreeNode<>();
convertTree(treeModel, root, membreModel, ResultPrivacy.REGISTERED_ONLY_NO_DETAILS); convertTree(treeModel, root, membreModel, ResultPrivacy.REGISTERED_ONLY_NO_DETAILS);
trees.add(root); trees.add(root);

View File

@ -292,24 +292,30 @@ public class RMatch {
if (!o.getCompet().getUuid().equals(connection.pathParam("uuid"))) if (!o.getCompet().getUuid().equals(connection.pathParam("uuid")))
throw new DForbiddenException("Permission denied"); throw new DForbiddenException("Permission denied");
})) }))
.invoke(m -> System.out.println("A00"))
.call(cm -> data.matchesToRemove.isEmpty() ? Uni.createFrom().voidItem() : .call(cm -> data.matchesToRemove.isEmpty() ? Uni.createFrom().voidItem() :
(Panache.withTransaction( (Panache.withTransaction(
() -> matchRepository.delete("id IN ?1 AND category = ?2", data.matchesToRemove, cm)) () -> matchRepository.delete("id IN ?1 AND category = ?2", data.matchesToRemove, cm))
.call(__ -> SSMatch.sendDeleteMatch(connection, data.matchesToRemove)))) .call(__ -> SSMatch.sendDeleteMatch(connection, data.matchesToRemove))))
.invoke(m -> System.out.println("A0"))
.call(cm -> Panache.withSession(() -> matchRepository.list("id IN ?1 AND category = ?2", .call(cm -> Panache.withSession(() -> matchRepository.list("id IN ?1 AND category = ?2",
Stream.concat(data.matchOrderToUpdate.keySet().stream(), Stream.concat(data.matchOrderToUpdate.keySet().stream(),
data.matchPouleToUpdate.keySet().stream()) data.matchPouleToUpdate.keySet().stream())
.distinct().toList(), cm) .distinct().toList(), cm)
.invoke(m -> System.out.println("A " + m.size()))
.invoke(matchModels -> matchModels.forEach(model -> { .invoke(matchModels -> matchModels.forEach(model -> {
if (data.matchPouleToUpdate.containsKey(model.getId())) if (data.matchPouleToUpdate.containsKey(model.getId()))
model.setPoule(data.matchPouleToUpdate.get(model.getId())); model.setPoule(data.matchPouleToUpdate.get(model.getId()));
if (data.matchOrderToUpdate.containsKey(model.getId())) if (data.matchOrderToUpdate.containsKey(model.getId()))
model.setCategory_ord(data.matchOrderToUpdate.get(model.getId())); model.setCategory_ord(data.matchOrderToUpdate.get(model.getId()));
})) }))
.invoke(m -> System.out.println("B " + m.size()))
.call(mm -> mm.isEmpty() ? Uni.createFrom().voidItem() : .call(mm -> mm.isEmpty() ? Uni.createFrom().voidItem() :
Panache.withTransaction(() -> matchRepository.persist(mm))) Panache.withTransaction(() -> matchRepository.persist(mm)))
.invoke(m -> System.out.println("C"))
.invoke(mm -> matches.addAll(mm.stream().map(MatchEntity::fromModel).toList()))) .invoke(mm -> matches.addAll(mm.stream().map(MatchEntity::fromModel).toList())))
) )
.invoke(m -> System.out.println("D"))
.chain(categoryModel -> { .chain(categoryModel -> {
Uni<List<MatchModel>> uni = Uni.createFrom().item(new ArrayList<>()); Uni<List<MatchModel>> uni = Uni.createFrom().item(new ArrayList<>());
for (AddMatch match : data.newMatch) for (AddMatch match : data.newMatch)
@ -318,9 +324,11 @@ public class RMatch {
return Panache.withSession(() -> finalUni); return Panache.withSession(() -> finalUni);
} }
) )
.invoke(m -> System.out.println("E"))
.chain(mm -> mm.isEmpty() ? Uni.createFrom().voidItem() : .chain(mm -> mm.isEmpty() ? Uni.createFrom().voidItem() :
Panache.withTransaction(() -> matchRepository.create(mm)) Panache.withTransaction(() -> matchRepository.create(mm))
.invoke(__ -> matches.addAll(mm.stream().map(MatchEntity::fromModel).toList()))) .invoke(__ -> matches.addAll(mm.stream().map(MatchEntity::fromModel).toList())))
.invoke(m -> System.out.println("F"))
.call(__ -> SSMatch.sendMatch(connection, matches)) .call(__ -> SSMatch.sendMatch(connection, matches))
.replaceWithVoid(); .replaceWithVoid();
} }

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 catégorie</a></li> <li><a onclick="setSubPage('poule')" href="javascript:void(0);">Par poule</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 catégorie</h4>'; content.innerHTML = '<h4>Recherche par poule</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 catégorie--</option>`; select.innerHTML = `<option value="0">--Sélectionner une poule--</option>`;
for (const pouleKey of Object.keys(poule).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))) { for (const pouleKey of Object.keys(poule).sort()) {
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 catégories"))) .catch(() => rootDiv.append(new Text("Erreur de chargement des poules")))
.finally(() => stopLoading(loading)); .finally(() => stopLoading(loading));
rfFonction = () => { rfFonction = () => {

View File

@ -150,15 +150,14 @@ 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((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]]) setCatId(data[Object.keys(data).sort()[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((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())) {Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)}
.map(key => <option key={key} value={data[key]}>{key}</option>)}
</select> </select>
</div> </div>
: error : error
@ -225,15 +224,14 @@ 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((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]]) setClubId(data[Object.keys(data).sort()[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((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())) {Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)}
.map(key => <option key={key} value={data[key]}>{key}</option>)}
</select> </select>
</div> </div>
: error : error
@ -312,15 +310,14 @@ 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((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]]) setCombId(data[Object.keys(data).sort()[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((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())) {Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)}
.map(key => <option key={key} value={data[key]}>{key}</option>)}
</select> </select>
</div> </div>
: error : error