Modern UI contract: live table in the ticker
Each live frame carries the league tables of the ticker's matches: the table before the matchday plus every match of that round at the frame's minute, the final whistle using the recorded result. Frames carry only changed tables; a single frame read gets the full standing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
74c1504e3a
commit
eb5c5d6211
4 files changed
+109
-6
No files matched your search
@@ -8825,7 +8825,17 @@ cli::Json ModernSession::read_live(const cli::Json& request) const {
|
||||
const cli::Json* seq = ui_field(request, "sequence");
|
||||
const auto& frames = *f->at("frames").array();
|
||||
if (!seq || !seq->integer() || *seq->integer() < 0 || size_t(*seq->integer()) >= frames.size()) return fail("invalid_live_sequence");
|
||||
return O{{"ok", true}, {"fixture_id", f->at("fixture_id")}, {"frame", frames[size_t(*seq->integer())]}};
|
||||
// a frame of the recording carries only the tables that changed in it; read alone it gets the
|
||||
// standing table of every league (the latest frame up to it that carried one)
|
||||
cli::Json frame = frames[size_t(*seq->integer())];
|
||||
std::map<std::string, cli::Json> tables;
|
||||
for (size_t k = 0; k <= size_t(*seq->integer()); ++k)
|
||||
for (const auto& t : *frames[k].object()->at("standings").array())
|
||||
tables[*t.object()->at("competitionId").string()] = t;
|
||||
cli::Json::Array standings;
|
||||
for (auto& [id, t] : tables) standings.push_back(std::move(t));
|
||||
std::get<O>(frame.value)["standings"] = std::move(standings);
|
||||
return O{{"ok", true}, {"fixture_id", f->at("fixture_id")}, {"frame", std::move(frame)}};
|
||||
}
|
||||
|
||||
cli::Json ModernSession::read_statistics_screen(const cli::Json& request) const {
|
||||
|
||||
Reference in new issue
Block a user