Bind cup reports and linked competition phases to live engine data (by Codex)
This commit is contained in:
1 parent
545e16f153
commit
6b4aa9772d
26 files changed
+402
-33
No files matched your search
@@ -11,7 +11,7 @@ using namespace bmh::modern_ui;
|
||||
int main(int argc, char **argv) {
|
||||
try {
|
||||
const std::string mode=argc>1?argv[1]:"";
|
||||
const std::set<std::string> modes{"prepare","prepare-two","prepare-national","prepare-almanac","inspect","inspect-friendlies","inspect-almanac","verify","verify-lineup","verify-sports","verify-bank","verify-commerce","verify-contracts","verify-calendar","verify-friendlies","verify-national","verify-almanac","verify-shootouts","verify-reports","verify-fixtures"};
|
||||
const std::set<std::string> modes{"prepare","prepare-two","prepare-national","prepare-almanac","inspect","inspect-friendlies","inspect-almanac","verify","verify-lineup","verify-sports","verify-bank","verify-commerce","verify-contracts","verify-calendar","verify-friendlies","verify-national","verify-almanac","verify-shootouts","verify-reports","verify-fixtures","verify-other"};
|
||||
if(argc!=4||!modes.contains(mode))throw std::runtime_error("usage: modern_engine_bridge_probe <prepare[-two|-national|-almanac]|inspect[-friendlies|-almanac]|verify[-lineup|-sports|-bank|-commerce|-contracts|-calendar|-friendlies|-national|-almanac|-shootouts]> <world.obw> <new-output-directory>");
|
||||
const fs::path world = argv[2], out = argv[3]; fs::create_directories(out);
|
||||
const auto write = [&](const char *file, const Json &j) { editor::write_atomic(out / file, j.dump(2)); };
|
||||
@@ -337,6 +337,17 @@ int main(int argc, char **argv) {
|
||||
write("saved.json",link->save_copy(out/"reports.obs"));link.reset();link=EngineBridge::open(world,out/"reports.obs");
|
||||
if(link->read({{"kind","report-index"}}).at("data")!=index_read.at("data"))throw std::runtime_error("report index changed after OBS restart");
|
||||
}
|
||||
if(mode=="verify-other") {
|
||||
const auto index=link->read({{"kind","other-index"}}),data=engine_other_index(before,index);write("other-index.json",index);Json all=Json::array();
|
||||
for(const auto &v:data.at("views"))for(int round=1;round<=v.at("rounds").get<int>();++round) {
|
||||
const Json request={{"kind","other-fixtures"},{"viewId",v.at("id")},{"round",round}};
|
||||
const auto read=link->read(request);(void)engine_other_projection(before,index,read,v.at("id"),round);
|
||||
if(link->read(request)!=read)throw std::runtime_error("cup read changed on repetition");all.push_back(read);
|
||||
}
|
||||
write("all-rounds.json",all);if(link->snapshot()!=before)throw std::runtime_error("cup reads mutated session");
|
||||
write("saved.json",link->save_copy(out/"other.obs"));link.reset();link=EngineBridge::open(world,out/"other.obs");
|
||||
if(link->read({{"kind","other-index"}}).at("data")!=index.at("data"))throw std::runtime_error("cup index changed on restart");
|
||||
}
|
||||
if(mode=="verify-fixtures") {
|
||||
const auto ir=link->read({{"kind","report-index"}}),idx=engine_report_index(before,ir);write("fixture-index.json",ir);Json rounds=Json::array();
|
||||
for(const auto &l:idx.at("leagues")) {
|
||||
|
||||
Reference in new issue
Block a user