Modern UI contract: press journal for business events

Business events cannot be derived from the almanac later, so a saved
journal notes them once: squad changes of the human clubs at a kickoff
(signed, free, sold, contract ended; clubs compared by identity across
the season's new draw positions), toto settlements, season change,
contract renewals and resigning. The news read merges it with the
almanac events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 18:22:50 +01:00
1 parent 9c436c753e
commit 651d262546
9 files changed
+318 -4

No files matched your search

+6 -1
View File
@@ -11,6 +11,7 @@
#include "game/state.hpp"
#include "game/table.hpp"
#include "modern/content/projections.hpp"
#include "modern/content/press_journal.hpp"
#include "modern/content/statistics.hpp"
#include "modern/content/world_package.hpp"
#include "modern/game/almanac.hpp"
@@ -382,12 +383,16 @@ cli::Json ui_read(const ModernState& g, const UiContext& c, const cli::Json& req
const int64_t limit = limit_field && limit_field->integer() && *limit_field->integer() > 0 ? *limit_field->integer() : 50;
J news = query_news(g, team_id(g, team), from, until);
A events = std::move(std::get<A>(std::get<O>(news.value).at("events").value));
for (J& e : journal_events(g, team_id(g, team), from, until)) events.push_back(std::move(e));
std::stable_sort(events.begin(), events.end(), [](const J& a, const J& b) {
return *std::get<O>(a.value).at("date").string() < *std::get<O>(b.value).at("date").string();
});
const size_t total = events.size();
if (events.size() > size_t(limit)) events.erase(events.begin(), events.end() - limit);
return snapshot(request_id, std::move(m),
O{{"kind", "news"}, {"teamId", team_id(g, team)}, {"from", from}, {"until", until}, {"total", int64_t(total)},
{"events", std::move(events)},
{"source", "almanac"}, {"note", "Spielereignisse, Serien und Saisonabschlüsse; Geschäftsereignisse folgen"}});
{"sources", A{J("almanac"), J("journal")}}});
}
if (kind == "calendar") {
// the season calendar of the desk's team: days from `from` to `until` (ISO dates, default