dev #92
@ -229,7 +229,10 @@ public class ResultService {
|
||||
|
||||
private void getTree(List<TreeModel> treeModels, MembreModel membreModel, ResultCategoryData out) {
|
||||
ArrayList<TreeNode<ResultCategoryData.TreeData>> trees = new ArrayList<>();
|
||||
treeModels.stream().filter(t -> t.getLevel() != 0).forEach(treeModel -> {
|
||||
treeModels.stream()
|
||||
.filter(t -> t.getLevel() != 0)
|
||||
.sorted(Comparator.comparing(TreeModel::getLevel))
|
||||
.forEach(treeModel -> {
|
||||
TreeNode<ResultCategoryData.TreeData> root = new TreeNode<>();
|
||||
convertTree(treeModel, root, membreModel, ResultPrivacy.REGISTERED_ONLY_NO_DETAILS);
|
||||
trees.add(root);
|
||||
|
||||
@ -292,30 +292,24 @@ public class RMatch {
|
||||
if (!o.getCompet().getUuid().equals(connection.pathParam("uuid")))
|
||||
throw new DForbiddenException("Permission denied");
|
||||
}))
|
||||
.invoke(m -> System.out.println("A00"))
|
||||
.call(cm -> data.matchesToRemove.isEmpty() ? Uni.createFrom().voidItem() :
|
||||
(Panache.withTransaction(
|
||||
() -> matchRepository.delete("id IN ?1 AND category = ?2", data.matchesToRemove, cm))
|
||||
.call(__ -> SSMatch.sendDeleteMatch(connection, data.matchesToRemove))))
|
||||
.invoke(m -> System.out.println("A0"))
|
||||
.call(cm -> Panache.withSession(() -> matchRepository.list("id IN ?1 AND category = ?2",
|
||||
Stream.concat(data.matchOrderToUpdate.keySet().stream(),
|
||||
data.matchPouleToUpdate.keySet().stream())
|
||||
.distinct().toList(), cm)
|
||||
.invoke(m -> System.out.println("A " + m.size()))
|
||||
.invoke(matchModels -> matchModels.forEach(model -> {
|
||||
if (data.matchPouleToUpdate.containsKey(model.getId()))
|
||||
model.setPoule(data.matchPouleToUpdate.get(model.getId()));
|
||||
if (data.matchOrderToUpdate.containsKey(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() :
|
||||
Panache.withTransaction(() -> matchRepository.persist(mm)))
|
||||
.invoke(m -> System.out.println("C"))
|
||||
.invoke(mm -> matches.addAll(mm.stream().map(MatchEntity::fromModel).toList())))
|
||||
)
|
||||
.invoke(m -> System.out.println("D"))
|
||||
.chain(categoryModel -> {
|
||||
Uni<List<MatchModel>> uni = Uni.createFrom().item(new ArrayList<>());
|
||||
for (AddMatch match : data.newMatch)
|
||||
@ -324,11 +318,9 @@ public class RMatch {
|
||||
return Panache.withSession(() -> finalUni);
|
||||
}
|
||||
)
|
||||
.invoke(m -> System.out.println("E"))
|
||||
.chain(mm -> mm.isEmpty() ? Uni.createFrom().voidItem() :
|
||||
Panache.withTransaction(() -> matchRepository.create(mm))
|
||||
.invoke(__ -> matches.addAll(mm.stream().map(MatchEntity::fromModel).toList())))
|
||||
.invoke(m -> System.out.println("F"))
|
||||
.call(__ -> SSMatch.sendMatch(connection, matches))
|
||||
.replaceWithVoid();
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ function homePage() {
|
||||
let content = document.createElement('div');
|
||||
content.innerHTML = `
|
||||
<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('club')" href="javascript:void(0);">Par club</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;
|
||||
const content = document.createElement('div');
|
||||
content.style.marginTop = '1em';
|
||||
content.innerHTML = '<h4>Recherche par poule</h4>';
|
||||
content.innerHTML = '<h4>Recherche par catégorie</h4>';
|
||||
|
||||
const dataContainer = document.createElement('div');
|
||||
dataContainer.id = 'data-container';
|
||||
@ -334,8 +334,8 @@ function poulePage(location) {
|
||||
.then(poule => {
|
||||
const select = document.createElement('select');
|
||||
select.setAttribute('id', poule.id);
|
||||
select.innerHTML = `<option value="0">--Sélectionner une poule--</option>`;
|
||||
for (const pouleKey of Object.keys(poule).sort()) {
|
||||
select.innerHTML = `<option value="0">--Sélectionner une catégorie--</option>`;
|
||||
for (const pouleKey of Object.keys(poule).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))) {
|
||||
select.innerHTML += `<option value="${poule[pouleKey]}">${pouleKey}</option>`;
|
||||
}
|
||||
select.addEventListener('change', e => {
|
||||
@ -356,7 +356,7 @@ function poulePage(location) {
|
||||
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));
|
||||
|
||||
rfFonction = () => {
|
||||
|
||||
@ -150,14 +150,15 @@ function CategoryList({uuid}) {
|
||||
|
||||
useEffect(() => {
|
||||
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]);
|
||||
|
||||
return <>
|
||||
{data ? <div className="input-group" style={{marginBottom: "1em"}}>
|
||||
<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)}>
|
||||
{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>
|
||||
</div>
|
||||
: error
|
||||
@ -224,14 +225,15 @@ function ClubList({uuid}) {
|
||||
|
||||
useEffect(() => {
|
||||
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]);
|
||||
|
||||
return <>
|
||||
{data ? <div className="input-group" style={{marginBottom: "1em"}}>
|
||||
<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)}>
|
||||
{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>
|
||||
</div>
|
||||
: error
|
||||
@ -310,14 +312,15 @@ function CombList({uuid}) {
|
||||
|
||||
useEffect(() => {
|
||||
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]);
|
||||
|
||||
return <>
|
||||
{data ? <div className="input-group" style={{marginBottom: "1em"}}>
|
||||
<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)}>
|
||||
{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>
|
||||
</div>
|
||||
: error
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user