Archiviert
1
0

Merge pull request 'Fix future event participations on team deletion' (#294) from bugfixes into master

Reviewed-on: SteamWar/BungeeCore#294
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2022-01-11 07:35:12 +01:00
Commit aa40bd1ec5
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<>();