geforkt von SteamWar/BungeeCore
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:
Commit
aa40bd1ec5
@ -146,6 +146,7 @@ public class Team {
|
||||
user.setLeader(false);
|
||||
delete.update(teamId);
|
||||
teamCache.remove(this);
|
||||
TeamTeilnahme.deleteFuture(teamId);
|
||||
}
|
||||
|
||||
public List<Integer> getMembers(){
|
||||
|
@ -28,6 +28,7 @@ public class TeamTeilnahme {
|
||||
|
||||
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 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 byEvent = new Statement("SELECT * FROM TeamTeilnahme WHERE EventID = ?");
|
||||
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);
|
||||
}
|
||||
|
||||
public static void deleteFuture(int teamID) {
|
||||
deleteFuture.update(teamID);
|
||||
}
|
||||
|
||||
public static Set<Team> getTeams(int eventID){
|
||||
return byEvent.select(rs -> {
|
||||
Set<Team> teams = new HashSet<>();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren