Compare commits
No commits in common. "0e269e0bf715e416a1404695a5569e868de60cd4" and "13bae3e81754b153def077db5335487f79d8a87c" have entirely different histories.
0e269e0bf7
...
13bae3e817
@ -115,15 +115,13 @@ public class ResultService {
|
||||
public Uni<ResultCategoryData> getCategory(String uuid, long poule, SecurityCtx securityCtx) {
|
||||
return hasAccess(uuid, securityCtx).chain(r ->
|
||||
matchRepository.list("category.compet.uuid = ?1 AND category.id = ?2", uuid, poule)
|
||||
.call(list -> list.isEmpty() ? Uni.createFrom().voidItem() :
|
||||
Mutiny.fetch(list.get(0).getCategory().getTree()))
|
||||
.call(list -> Mutiny.fetch(list.get(0).getCategory().getTree()))
|
||||
.map(list -> getData(list, r.getMembre())));
|
||||
}
|
||||
|
||||
public Uni<ResultCategoryData> getCategory(String uuid, long poule) {
|
||||
return matchRepository.list("category.compet.uuid = ?1 AND category.id = ?2", uuid, poule)
|
||||
.call(list -> list.isEmpty() ? Uni.createFrom().voidItem() :
|
||||
Mutiny.fetch(list.get(0).getCategory().getTree()))
|
||||
.call(list -> Mutiny.fetch(list.get(0).getCategory().getTree()))
|
||||
.map(list -> getData(list, null));
|
||||
}
|
||||
|
||||
|
||||
@ -292,43 +292,32 @@ 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.withTransaction(
|
||||
() -> matchRepository.delete("id IN ?1 AND category = ?2", data.matchesToRemove, cm))
|
||||
.call(__ -> SSMatch.sendDeleteMatch(connection, data.matchesToRemove)))
|
||||
.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"))
|
||||
.call(mm -> Panache.withTransaction(() -> matchRepository.persist(mm)))
|
||||
.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)
|
||||
uni = uni.call(l -> creatMatch(categoryModel, match).invoke(l::add));
|
||||
Uni<List<MatchModel>> finalUni = uni;
|
||||
return Panache.withSession(() -> finalUni);
|
||||
Uni<List<MatchModel>> finalUni = uni;
|
||||
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"))
|
||||
.chain(mm -> Panache.withTransaction(() -> matchRepository.create(mm))
|
||||
.invoke(__ -> matches.addAll(mm.stream().map(MatchEntity::fromModel).toList())))
|
||||
.call(__ -> SSMatch.sendMatch(connection, matches))
|
||||
.replaceWithVoid();
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ function CMTMatchPanel({catId, cat, menuActions}) {
|
||||
setLoading(1);
|
||||
sendRequest('getFullCategory', catId)
|
||||
.then((data) => {
|
||||
setTrees(data.trees.sort((a, b) => a.level - b.level).map(d => from_sendTree(d, true)))
|
||||
setTrees(data.trees.map(d => from_sendTree(d, true)))
|
||||
|
||||
let matches2 = [];
|
||||
let combsToAdd = [];
|
||||
@ -101,7 +101,7 @@ function CMTMatchPanel({catId, cat, menuActions}) {
|
||||
const treeListener = ({data}) => {
|
||||
if (data.length < 1 || data[0].categorie !== catId)
|
||||
return
|
||||
setTrees(data.sort((a, b) => a.level - b.level).map(d => from_sendTree(d, true)))
|
||||
setTrees(data.map(d => from_sendTree(d, true)))
|
||||
|
||||
let matches2 = [];
|
||||
let combsToAdd = [];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user