SteamWar/BungeeCore
Archiviert
13
2

Fix future event participations on team deletion
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-01-08 08:46:28 +01:00
Ursprung 1c50d61a28
Commit 361077cc3e
2 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -146,6 +146,7 @@ public class Team {
user.setLeader(false); user.setLeader(false);
delete.update(teamId); delete.update(teamId);
teamCache.remove(this); teamCache.remove(this);
TeamTeilnahme.deleteFuture(teamId);
} }
public List<Integer> getMembers(){ public List<Integer> getMembers(){

Datei anzeigen

@ -28,6 +28,7 @@ public class TeamTeilnahme {
private static final Statement insert = new Statement("INSERT INTO TeamTeilnahme (TeamID, EventID) VALUES (?, ?)"); private static final Statement insert = new Statement("INSERT INTO TeamTeilnahme (TeamID, EventID) VALUES (?, ?)");
private static final Statement delete = new Statement("DELETE FROM TeamTeilnahme WHERE TeamID = ? AND EventID = ?"); private static final Statement delete = new Statement("DELETE FROM TeamTeilnahme WHERE TeamID = ? AND EventID = ?");
private static final Statement deleteFuture = new Statement("DELETE FROM TeamTeilnahme t WHERE t.TeamID = ? AND (SELECT e.Start FROM Event e WHERE e.EventID = t.EventID) > NOW()");
private static final Statement byEventTeam = new Statement("SELECT * FROM TeamTeilnahme WHERE TeamID = ? AND EventID = ?"); private static final Statement byEventTeam = new Statement("SELECT * FROM TeamTeilnahme WHERE TeamID = ? AND EventID = ?");
private static final Statement byEvent = new Statement("SELECT * FROM TeamTeilnahme WHERE EventID = ?"); private static final Statement byEvent = new Statement("SELECT * FROM TeamTeilnahme WHERE EventID = ?");
private static final Statement byTeam = new Statement("SELECT * FROM TeamTeilnahme WHERE TeamID = ?"); private static final Statement byTeam = new Statement("SELECT * FROM TeamTeilnahme WHERE TeamID = ?");
@ -44,6 +45,10 @@ public class TeamTeilnahme {
return byEventTeam.select(ResultSet::next, teamID, eventID); return byEventTeam.select(ResultSet::next, teamID, eventID);
} }
public static void deleteFuture(int teamID) {
deleteFuture.update(teamID);
}
public static Set<Team> getTeams(int eventID){ public static Set<Team> getTeams(int eventID){
return byEvent.select(rs -> { return byEvent.select(rs -> {
Set<Team> teams = new HashSet<>(); Set<Team> teams = new HashSet<>();