Add Replay WIPISCH #334
@ -11,7 +11,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class Fight {
|
||||
|
||||
private static final Statement getPage = new Statement("SELECT f.FightID, f.GameMode, f.Server, f.StartTime, f.BlueLeader, f.RedLeader, (b.NodeId IS NULL OR b.AllowReplay) AND (r.NodeId IS NULL OR r.AllowReplay) AS ReplayAllowed, f.Win, f.Replay IS NOT NULL AS ReplayExists FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?");
|
||||
private static final Statement getPage = new Statement("SELECT f.FightID, f.GameMode, f.Server, f.StartTime, f.BlueLeader, f.RedLeader, (b.NodeId IS NULL OR b.AllowReplay) AND (r.NodeId IS NULL OR r.AllowReplay) AS ReplayAllowed, f.Win, (SELECT COUNT(1) FROM Replay WHERE Replay.FightID = f.FightID) as ReplayAvailable FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?");
|
||||
|
||||
private final int fightID;
|
||||
private final String gameMode;
|
||||
@ -22,8 +22,8 @@ public class Fight {
|
||||
private final int redLeader;
|
||||
private final int win;
|
||||
|
||||
private final boolean replayExists;
|
||||
private final boolean replayAllowed;
|
||||
private final boolean replayAvailable;
|
||||
|
||||
private final List<FightPlayer> bluePlayers = new ArrayList<>();
|
||||
private final List<FightPlayer> redPlayers = new ArrayList<>();
|
||||
@ -36,8 +36,8 @@ public class Fight {
|
||||
blueLeader = rs.getInt("BlueLeader");
|
||||
redLeader = rs.getInt("RedLeader");
|
||||
replayAllowed = rs.getBoolean("ReplayAllowed");
|
||||
replayAvailable = rs.getBoolean("ReplayAvailable");
|
||||
win = rs.getInt("Win");
|
||||
replayExists = rs.getBoolean("ReplayExists");
|
||||
}
|
||||
|
||||
private void initPlayers(List<FightPlayer> fightPlayers) {
|
||||
@ -118,6 +118,6 @@ public class Fight {
|
||||
}
|
||||
|
||||
|
||||
public boolean replayExists() {
|
||||
return replayExists && getGameMode() != null;
|
||||
return getGameMode() != null && replayAvailable;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Das würde ich unbedingt ins SQL-Statement mit einbauen, da wir im SQL-Statement ja gleich 45 Replays auf einmal holen. Wenn du immer einzeln auf das Replay prüfst, erhöhst du die SQL-Abfragenmenge auf 48 (von 3). Das dürfte wahrscheinlich (vor allem weil davon 45 auf der dicken Replay-Tabelle stattfinden) sehr langsam werden.