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
@@ -577,6 +577,8 @@ int main(int argc, char** argv) {
|
||||
check(s(at(stepped, "messageType")) == "command_result" && at(state, "minute").integer() &&
|
||||
*at(state, "minute").integer() >= 30, "thirty minutes on");
|
||||
std::printf("(live state: %s)\n", cli::dump_json(state).substr(0, 400).c_str());
|
||||
check(at(state, "standings").array() != nullptr, "the paused kickoff names its live tables");
|
||||
std::printf("(paused live tables: %zu)\n", at(state, "standings").array() ? at(state, "standings").array()->size() : 0);
|
||||
if (const auto* live = at(state, "matches").array(); live && !live->empty()) {
|
||||
int goals = 0;
|
||||
for (const auto& e : *at((*live)[0], "events").array()) goals += s(at(e, "kind")) == "goal";
|
||||
@@ -611,6 +613,23 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
check(s(at(session.ui_command(cmd("request:lz", "live.step", O{}), rev), "code")) == "live_not_running", "no live kickoff");
|
||||
}
|
||||
// a paused league match: its live table (the league as it stands with the scores so far)
|
||||
{
|
||||
bool seen = false;
|
||||
for (int k = 0; k < 16 && !seen; ++k) {
|
||||
session.ui_command(cmd("request:lt" + std::to_string(k), "session.advance", O{{"live", true}}), rev);
|
||||
const J state = session.read_live(O{{"kind", "fixture"}});
|
||||
if (!truth(at(state, "live"))) continue;
|
||||
if (const auto* tables = at(state, "standings").array(); tables && !tables->empty()) {
|
||||
const auto* rows = at(tables->front(), "rows").array();
|
||||
seen = rows && rows->size() >= 10 && *at(rows->front(), "rank").integer() == 1;
|
||||
std::printf("(paused league table: %s, %zu rows)\n", s(at(tables->front(), "name")).c_str(), rows ? rows->size() : 0);
|
||||
check(seen, "the paused league match has its live table");
|
||||
}
|
||||
session.ui_command(cmd("request:ltf" + std::to_string(k), "live.finish", O{}), rev);
|
||||
}
|
||||
if (!seen) std::printf("(no paused league match on this path)\n");
|
||||
}
|
||||
// a season of kickoffs: running-out contracts stop the run with decision_pending and the
|
||||
// player; the advance is sent again with the answer (here: release)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user