Show the season opening when a running Modern career reaches a new season

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 08:39:51 +01:00
1 parent fee03624be
commit 749c5ec512
2 files changed
+30 -3

No files matched your search

+17 -2
View File
@@ -1,4 +1,16 @@
// SPDX-License-Identifier: GPL-3.0-only
namespace {
// A kickoff that reached a new season carries that season's draw for the opening view.
void engine_attach_opening(EngineBridge &link, const std::string &season_before, const Json &after, Json &response) {
try {
const std::string season_after = after.at("desktop").at("meta").at("season").at("id");
if (!season_before.empty() && season_after != season_before) response["seasonOpening"] = link.read({{"kind", "opening"}});
} catch (const std::exception &) {}
}
std::string engine_season_id(const Json &bundle) {
try { return bundle.at("desktop").at("meta").at("season").at("id"); } catch (const std::exception &) { return {}; }
}
} // namespace
bool App::live_open() {
if (!source_) { message("Für diese Ansicht steht keine Live-Datenquelle bereit."); return false; }
const auto snapshot = snap();
@@ -153,9 +165,12 @@ void App::engine_live_poll() {
auto link = engine_link_;
if (accepted) {
engine_live_at_end_ = true;
engine_start("Abpfiff …", [link, state] {
const std::string season = engine_season_id(engine_data_);
engine_start("Abpfiff …", [link, state, season] {
Json finished = {{"messageType", "live_finished"}, {"liveRecording", state}};
return EngineReply{link, link->snapshot(), finished, nullptr};
auto after = link->snapshot();
engine_attach_opening(*link, season, after, finished);
return EngineReply{link, std::move(after), finished, nullptr};
}, true);
} else {
// the engine took the kickoff back (a question it could not ask in time): back to the desk