The interested clubs show the squad's age and the last league matches
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
101273f777
commit
112b8492d9
4 files changed
+65
-2
No files matched your search
@@ -185,10 +185,34 @@ std::string App::engine_assembly_sheet() {
|
||||
return "<div class=\"cs-money\"><span class=\"cs-label\">" + std::string(label) + "</span><div class=\"cs-track\"><div class=\"cs-fill " + std::string(value < 0 ? "debt" : css) + "\" style=\"width:" +
|
||||
scalar(std::max(2.0, 100.0 * double(std::llabs(value)) / scale)) + "%;\"></div></div><span class=\"cs-sum\">" + assembly_count(value) + " €</span></div>";
|
||||
};
|
||||
// the mean age of both squads
|
||||
const auto age_bar = [&](const std::string &label, const Json &row, const char *css) {
|
||||
const bool known = row.contains("averageAge") && row.at("averageAge").is_number_integer();
|
||||
const int tenths = known ? row.at("averageAge").get<int>() : 0;
|
||||
return "<div class=\"cs-money\"><span class=\"cs-label\">" + esc(label) + "</span><div class=\"cs-track\"><div class=\"cs-fill " + std::string(css) + "\" style=\"width:" +
|
||||
scalar(known ? std::clamp((tenths - 160) / 2.0, 4.0, 100.0) : 0.0) + "%;\"></div></div><span class=\"cs-sum cs-age\">" +
|
||||
(known ? std::to_string(tenths / 10) + "," + std::to_string(tenths % 10) + " Jahre" : std::string("—")) + "</span></div>";
|
||||
};
|
||||
const std::string ages = "<section class=\"cs-box cs-cash\"><span class=\"pg-k\">ALTERSSCHNITT DES KADERS</span>" + age_bar(mine, own, "own") + age_bar(name, c, "new") + "</section>";
|
||||
// the last league matches: won, drawn or lost, with the score
|
||||
std::string form = "<section class=\"cs-box cs-form\"><span class=\"pg-k\">LETZTE LIGASPIELE</span>";
|
||||
const Json results = c.value("results", Json::array());
|
||||
if (results.empty()) form += "<div class=\"cs-none small\">Noch kein Ligaspiel in dieser Saison.</div>";
|
||||
else {
|
||||
form += "<div class=\"cs-games\">";
|
||||
for (const auto &game : results) {
|
||||
const std::string outcome = game.value("outcome", std::string("draw"));
|
||||
form += "<div class=\"cs-game\"><div class=\"cs-dot " + outcome + "\">" + (outcome == "win" ? "S" : outcome == "loss" ? "N" : "U") + "</div><div class=\"cs-score\">" + std::to_string(game.value("goalsFor", 0)) + ":" +
|
||||
std::to_string(game.value("goalsAgainst", 0)) + "</div><div class=\"cs-where\">" + (game.value("home", false) ? "Heim" : "Auswärts") + "</div></div>";
|
||||
}
|
||||
form += "</div>";
|
||||
}
|
||||
form += "</section>";
|
||||
out += "<div class=\"cs-row\"><section class=\"cs-box cs-cash\"><span class=\"pg-k\">VEREINSKASSE</span>" + money_bar("Dein Konto heute", now, "own") + money_bar("Startkapital dort", then, "new") +
|
||||
"</section><section class=\"cs-box cs-fact\"><span class=\"pg-k\">STADION</span><strong>" +
|
||||
(c.contains("stadiumCapacity") && c.at("stadiumCapacity").is_number_integer() ? assembly_count(c.at("stadiumCapacity").get<int64_t>()) : std::string("—")) +
|
||||
"</strong><span>Plätze zum Start</span></section><section class=\"cs-box cs-fact\"><span class=\"pg-k\">KADER</span><strong>" + std::to_string(c.value("squad", 0)) + "</strong><span>Spieler</span></section></div>" +
|
||||
"<div class=\"cs-row\">" + ages + form + "</div>" +
|
||||
"<p class=\"cs-note\">Beim Wechsel bleiben dein Konto, deine Aktien, Fonds und Kredite zurück. Stadion, Verträge und Werbung beginnen beim neuen Verein neu.</p>";
|
||||
}
|
||||
out += "</div></div><nav class=\"pg-dlg-act\">" + pg_button("assembly-close", forced ? "Zum Schreibtisch" : "Abbrechen", "", "id=\"assembly-close\"") +
|
||||
|
||||
Reference in new issue
Block a user