Fixed - sealed tournament no longer depends on (removed) db query to issue starting material

This commit is contained in:
jakub.salavec
2025-04-17 13:27:11 +02:00
parent 46f98fd144
commit a27889f058
2 changed files with 19 additions and 1 deletions

View File

@@ -25,6 +25,8 @@ public class SealedTournament extends BaseTournament implements Tournament {
private SealedTournamentInfo _sealedInfo;
private ZonedDateTime nextRoundStart = null;
private boolean collectionsCreated = false;
public SealedTournament(TournamentService tournamentService, CollectionsManager collectionsManager, ProductLibrary productLibrary,
LotroFormatLibrary formatLibrary, SoloDraftDefinitions soloDraftDefinitions, TableDraftDefinitions tableDraftDefinitions, TableHolder tables, String tournamentId) {
super(tournamentService, collectionsManager, productLibrary, formatLibrary, soloDraftDefinitions, tableDraftDefinitions, tables, tournamentId);
@@ -90,7 +92,11 @@ public class SealedTournament extends BaseTournament implements Tournament {
_collectionsManager.addPlayerCollection(true, "Sealed tournament product", player, collDef, newCollection);
}
public void createAndPopulateCollections() {
private void createAndPopulateCollections() {
if (collectionsCreated) {
return;
}
var collDef = _sealedInfo.generateCollectionInfo();
var collections = _collectionsManager.getPlayersCollection(collDef.getCode());
var sealedDef = _sealedInfo.SealedDefinition;
@@ -107,6 +113,8 @@ public class SealedTournament extends BaseTournament implements Tournament {
_collectionsManager.addPlayerCollection(true, "Sealed tournament product", playerName, collDef, newCollection);
}
collectionsCreated = true;
}
public void disqualifyUnregisteredPlayers() {
@@ -170,6 +178,8 @@ public class SealedTournament extends BaseTournament implements Tournament {
_tournamentInfo.Stage = Stage.DECK_BUILDING;
_tournamentService.recordTournamentStage(_tournamentId, getTournamentStage());
createAndPopulateCollections();
String duration = DateUtils.HumanDuration(_sealedInfo.DeckbuildingDuration);
result.add(new BroadcastAction("Sealed product has been issued for tournament <b>" + getTournamentName() + "</b>. Players now have "
+ duration + " to open packs and build a deck with the cards you open. "

View File

@@ -28,6 +28,8 @@ public class SoloDraftTournament extends BaseTournament implements Tournament {
private SoloDraftTournamentInfo _soloDraftInfo;
private ZonedDateTime nextRoundStart = null;
private boolean collectionsCreated = false;
public SoloDraftTournament(TournamentService tournamentService, CollectionsManager collectionsManager, ProductLibrary productLibrary,
LotroFormatLibrary formatLibrary, SoloDraftDefinitions soloDraftDefinitions, TableDraftDefinitions tableDraftDefinitions, TableHolder tables, String tournamentId) {
super(tournamentService, collectionsManager, productLibrary, formatLibrary, soloDraftDefinitions, tableDraftDefinitions, tables, tournamentId);
@@ -112,6 +114,10 @@ public class SoloDraftTournament extends BaseTournament implements Tournament {
}
private void createStartingCollections() {
if (collectionsCreated) {
return;
}
var collDef = _soloDraftInfo.generateCollectionInfo();
var collections = _collectionsManager.getPlayersCollection(collDef.getCode());
@@ -134,6 +140,8 @@ public class SoloDraftTournament extends BaseTournament implements Tournament {
_collectionsManager.addPlayerCollection(false, "Draft tournament product", playerName, collDef, startingCollection);
}
collectionsCreated = true;
}
private long getSeed(String playerName, CollectionType collectionType) {