feat: handle goalkeeper vs field player equipment differentiation
This commit is contained in:
@@ -23,6 +23,9 @@ public class Equipement {
|
||||
@Column(name = "gestion_sexe", nullable = false)
|
||||
private boolean gestionSexe = false;
|
||||
|
||||
@Column(name = "type_public", nullable = false, length = 20)
|
||||
private String typePublic = "TOUS"; // JOUEUR, GARDIEN, TOUS
|
||||
|
||||
@Column(name = "tailles_disponibles", length = 500)
|
||||
private String taillesDisponibles;
|
||||
|
||||
@@ -51,6 +54,9 @@ public class Equipement {
|
||||
public boolean isGestionSexe() { return gestionSexe; }
|
||||
public void setGestionSexe(boolean gestionSexe) { this.gestionSexe = gestionSexe; }
|
||||
|
||||
public String getTypePublic() { return typePublic; }
|
||||
public void setTypePublic(String typePublic) { this.typePublic = typePublic; }
|
||||
|
||||
public String getTaillesDisponibles() { return taillesDisponibles; }
|
||||
public void setTaillesDisponibles(String taillesDisponibles) { this.taillesDisponibles = taillesDisponibles; }
|
||||
|
||||
|
||||
@@ -86,12 +86,21 @@ public class CategorieService {
|
||||
List<Dotation> currentDotations = licence.getDotations();
|
||||
List<Dotation> toRemove = new ArrayList<>();
|
||||
|
||||
// Remove dotations for equipements no longer in the category
|
||||
// Remove dotations for equipements no longer in the category or not matching public
|
||||
for (Dotation d : currentDotations) {
|
||||
boolean found = false;
|
||||
for (CategorieEquipement ce : categorieEquipements) {
|
||||
if (ce.getEquipement().getId().equals(d.getEquipement().getId())) {
|
||||
found = true;
|
||||
String typePublic = ce.getEquipement().getTypePublic();
|
||||
String typeMaillot = licence.getAdherent() != null ? licence.getAdherent().getTypeMaillot() : "JOUEUR";
|
||||
|
||||
boolean matchPublic = "TOUS".equals(typePublic) ||
|
||||
("GARDIEN".equals(typePublic) && "GARDIEN".equals(typeMaillot)) ||
|
||||
("JOUEUR".equals(typePublic) && "JOUEUR".equals(typeMaillot));
|
||||
|
||||
if (matchPublic) {
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -103,6 +112,17 @@ public class CategorieService {
|
||||
|
||||
// Add missing dotations
|
||||
for (CategorieEquipement ce : categorieEquipements) {
|
||||
String typePublic = ce.getEquipement().getTypePublic();
|
||||
String typeMaillot = licence.getAdherent() != null ? licence.getAdherent().getTypeMaillot() : "JOUEUR";
|
||||
|
||||
boolean matchPublic = "TOUS".equals(typePublic) ||
|
||||
("GARDIEN".equals(typePublic) && "GARDIEN".equals(typeMaillot)) ||
|
||||
("JOUEUR".equals(typePublic) && "JOUEUR".equals(typeMaillot));
|
||||
|
||||
if (!matchPublic) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean found = false;
|
||||
for (Dotation d : currentDotations) {
|
||||
if (ce.getEquipement().getId().equals(d.getEquipement().getId())) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE equipement ADD COLUMN type_public VARCHAR(20) DEFAULT 'TOUS' NOT NULL;
|
||||
Reference in New Issue
Block a user