dev #106

Merged
Thibaut merged 8 commits from dev into master 2026-01-30 14:07:08 +00:00
8 changed files with 2 additions and 124 deletions
Showing only changes of commit 4c260b86b9 - Show all commits

View File

@ -1,42 +0,0 @@
package fr.titionfire.ffsaf.data.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@RegisterForReflection
@Entity
@Table(name = "cardboard")
public class CardboardModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "comb", referencedColumnName = "id")
MembreModel comb;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "guest_comb", referencedColumnName = "id")
CompetitionGuestModel guestComb;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "match", referencedColumnName = "id")
MatchModel match;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "compet", referencedColumnName = "id")
CompetitionModel compet;
int red;
int yellow;
}

View File

@ -63,10 +63,6 @@ public class MatchModel {
char poule = 'A'; char poule = 'A';
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "match", referencedColumnName = "id")
List<CardboardModel> cardboard = new ArrayList<>();
public String getC1Name(MembreModel model, ResultPrivacy privacy) { public String getC1Name(MembreModel model, ResultPrivacy privacy) {
if (c1_id != null) if (c1_id != null)
return c1_id.getName(model, privacy); return c1_id.getName(model, privacy);

View File

@ -1,9 +0,0 @@
package fr.titionfire.ffsaf.data.repository;
import fr.titionfire.ffsaf.data.model.CardboardModel;
import io.quarkus.hibernate.reactive.panache.PanacheRepositoryBase;
import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class CardboardRepository implements PanacheRepositoryBase<CardboardModel, Long> {
}

View File

@ -1,26 +0,0 @@
package fr.titionfire.ffsaf.domain.entity;
import fr.titionfire.ffsaf.data.model.CardboardModel;
import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
@RegisterForReflection
public class CardboardEntity {
long comb_id;
long match_id;
long compet_id;
int red;
int yellow;
public static CardboardEntity fromModel(CardboardModel model) {
return new CardboardEntity(
model.getComb() != null ? model.getComb().getId() : model.getGuestComb().getId() * -1,
model.getMatch().getId(),
model.getCompet().getId(),
model.getRed(), model.getYellow());
}
}

View File

@ -6,7 +6,6 @@ import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -23,7 +22,6 @@ public class MatchEntity {
private Date date; private Date date;
private List<ScoreEmbeddable> scores; private List<ScoreEmbeddable> scores;
private char poule; private char poule;
private List<CardboardEntity> cardboard;
public static MatchEntity fromModel(MatchModel model) { public static MatchEntity fromModel(MatchModel model) {
if (model == null) if (model == null)
@ -35,22 +33,6 @@ public class MatchEntity {
model.getC2_id()), model.getC2_id()),
model.getCategory_ord(), model.isEnd(), model.getCategory().getId(), model.getDate(), model.getCategory_ord(), model.isEnd(), model.getCategory().getId(), model.getDate(),
model.getScores(), model.getScores(),
model.getPoule(), model.getPoule());
(model.getCardboard() == null) ? new ArrayList<>() : model.getCardboard().stream()
.map(CardboardEntity::fromModel).toList());
}
public int win() {
int sum = 0;
for (ScoreEmbeddable score : scores) {
if (score.getS1() == -1000 || score.getS2() == -1000)
continue;
if (score.getS1() > score.getS2())
sum++;
else if (score.getS1() < score.getS2())
sum--;
}
return sum;
} }
} }

View File

@ -46,9 +46,6 @@ public class RCategorie {
@Inject @Inject
TreeRepository treeRepository; TreeRepository treeRepository;
@Inject
CardboardRepository cardboardRepository;
@Inject @Inject
CardService cardService; CardService cardService;
@ -221,7 +218,6 @@ public class RCategorie {
public Uni<Void> deleteCategory(WebSocketConnection connection, Long id) { public Uni<Void> deleteCategory(WebSocketConnection connection, Long id) {
return getById(id, connection) return getById(id, connection)
.call(cat -> Panache.withTransaction(() -> treeRepository.delete("category = ?1", cat.getId()) .call(cat -> Panache.withTransaction(() -> treeRepository.delete("category = ?1", cat.getId())
.call(__ -> cardboardRepository.delete("match.category = ?1", cat))
.call(__ -> matchRepository.delete("category = ?1", cat)))) .call(__ -> matchRepository.delete("category = ?1", cat))))
.chain(cat -> Panache.withTransaction(() -> categoryRepository.delete(cat))) .chain(cat -> Panache.withTransaction(() -> categoryRepository.delete(cat)))
.invoke(__ -> SSCategorie.sendDelCategory(connection, id)) .invoke(__ -> SSCategorie.sendDelCategory(connection, id))

View File

@ -45,9 +45,6 @@ public class RMatch {
@Inject @Inject
CompetitionGuestRepository competitionGuestRepository; CompetitionGuestRepository competitionGuestRepository;
@Inject
CardboardRepository cardboardRepository;
@Inject @Inject
TradService trad; TradService trad;
@ -289,9 +286,7 @@ public class RMatch {
public Uni<Void> deleteMatch(WebSocketConnection connection, Long idMatch) { public Uni<Void> deleteMatch(WebSocketConnection connection, Long idMatch) {
return getById(idMatch, connection) return getById(idMatch, connection)
.map(__ -> idMatch) .map(__ -> idMatch)
.chain(l -> Panache.withTransaction(() -> .chain(l -> Panache.withTransaction(() -> matchRepository.delete("id = ?1", l)))
cardboardRepository.delete("match.id = ?1", l)
.chain(__ -> matchRepository.delete("id = ?1", l))))
.invoke(__ -> SSMatch.sendDeleteMatch(connection, idMatch)) .invoke(__ -> SSMatch.sendDeleteMatch(connection, idMatch))
.replaceWithVoid(); .replaceWithVoid();
} }

View File

@ -117,20 +117,6 @@ public class RState {
} }
} }
public List<Long> getAllCategories(String uuid) {
return tableStates.values().stream()
.filter(s -> s.getCompetitionUuid()
.equals(uuid) && s.getSelectedCategory() != null && s.getSelectedCategory() != -1)
.map(TableState::getSelectedCategory).distinct().toList();
}
public List<Long> getAllMatchActive(String uuid) {
return tableStates.values().stream()
.filter(s -> s.getCompetitionUuid()
.equals(uuid) && s.getState() == MatchState.IN_PROGRESS && s.getSelectedMatch() != null && s.getSelectedMatch() != -1)
.map(TableState::getSelectedMatch).distinct().toList();
}
@RegisterForReflection @RegisterForReflection
public record ChronoState(long time, long startTime, long configTime, long configPause, int state) { public record ChronoState(long time, long startTime, long configTime, long configPause, int state) {
public boolean isRunning() { public boolean isRunning() {