fix pending match state when loading in-progress tournament

This commit is contained in:
Martin Michelsen
2023-09-23 08:46:58 -07:00
parent 99b508a256
commit fe984a4284
+5 -2
View File
@@ -464,12 +464,15 @@ void Tournament::create_bracket_matches() {
throw logic_error("tournaments team count is not a power of 2"); throw logic_error("tournaments team count is not a power of 2");
} }
// Create the zero-round matches and make them all pending // Create the zero-round matches, and make them all pending if registration
// is still open
this->zero_round_matches.clear(); this->zero_round_matches.clear();
for (const auto& team : this->teams) { for (const auto& team : this->teams) {
auto m = make_shared<Match>(this->shared_from_this(), team); auto m = make_shared<Match>(this->shared_from_this(), team);
this->zero_round_matches.emplace_back(m); this->zero_round_matches.emplace_back(m);
this->pending_matches.emplace(m); if (this->current_state == State::REGISTRATION) {
this->pending_matches.emplace(m);
}
} }
// Create the bracket matches // Create the bracket matches