Modern UI contract: live table in the paused kickoff
live_league_table is shared by the recording and the paused live state; a paused league match now reports its league with the running scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb5c5d6211
commit
6e400d708c
5 files changed
+92
-38
No files matched your search
@@ -8809,7 +8809,25 @@ cli::Json ModernSession::read_live(const cli::Json& request) const {
|
||||
{"awayManagerId", am >= 0 ? cli::Json(modern::ui_manager_id(g_, am)) : cli::Json(nullptr)},
|
||||
{"score", cli::Json::Array{cli::Json(h), cli::Json(a)}}});
|
||||
}
|
||||
return O{{"ok", true}, {"live", true}, {"status", "paused"}, {"minute", live_->minute}, {"matches", std::move(matches)}};
|
||||
// the live tables: each league group with a live match, its matches at their score so far
|
||||
// (the group's results reach the season's result bytes only after its final whistle)
|
||||
cli::Json::Array standings;
|
||||
for (const MatchGroup& grp : *live_->groups) {
|
||||
const uint32_t league = grp.desc.size() >= 0xd0 ? le32(grp.desc, 0xcc) : 0xffffffffu;
|
||||
if (league >= uint32_t(kLeagueCount) || grp.results.size() != size_t(grp.matches())) continue;
|
||||
std::vector<modern::LiveGame> games;
|
||||
bool live = false;
|
||||
for (int m = 0; m < grp.matches(); ++m) {
|
||||
const int home = grp.fixtures.at(size_t(m) * 2), away = grp.fixtures.at(size_t(m) * 2 + 1);
|
||||
live |= std::find(g_.live_matches.begin(), g_.live_matches.end(), home) != g_.live_matches.end();
|
||||
const int h = grp.results[size_t(m)] >> 4, a = grp.results[size_t(m)] & 0xf;
|
||||
if (h < 0xc && a < 0xc) games.push_back({home, away, h, a});
|
||||
}
|
||||
if (live && league < g_.league_rounds.size())
|
||||
standings.push_back(modern::live_league_table(g_, int(league), int(g_.league_rounds[league]) + 1, games));
|
||||
}
|
||||
return O{{"ok", true}, {"live", true}, {"status", "paused"}, {"minute", live_->minute}, {"matches", std::move(matches)},
|
||||
{"standings", std::move(standings)}};
|
||||
}
|
||||
if (!ui_last_advance_) return fail("live_unavailable");
|
||||
if (const cli::Json* r = ui_field(request, "revision"); r && (!r->integer() || uint64_t(*r->integer()) != ui_last_advance_revision_))
|
||||
|
||||
Reference in new issue
Block a user