commit
5444235512
@ -229,11 +229,14 @@ 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().filter(t -> t.getLevel() != 0).forEach(treeModel -> {
|
treeModels.stream()
|
||||||
TreeNode<ResultCategoryData.TreeData> root = new TreeNode<>();
|
.filter(t -> t.getLevel() != 0)
|
||||||
convertTree(treeModel, root, membreModel, ResultPrivacy.REGISTERED_ONLY_NO_DETAILS);
|
.sorted(Comparator.comparing(TreeModel::getLevel))
|
||||||
trees.add(root);
|
.forEach(treeModel -> {
|
||||||
});
|
TreeNode<ResultCategoryData.TreeData> root = new TreeNode<>();
|
||||||
|
convertTree(treeModel, root, membreModel, ResultPrivacy.REGISTERED_ONLY_NO_DETAILS);
|
||||||
|
trees.add(root);
|
||||||
|
});
|
||||||
out.setTrees(trees);
|
out.setTrees(trees);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -292,30 +292,24 @@ 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)
|
||||||
@ -324,11 +318,9 @@ 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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 = () => {
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user