Bind native statistics to recorded careers and correct cup winners (by Codex)
This commit is contained in:
1 parent
e3ea03a05d
commit
eb140cdb1c
24 files changed
+296
-33
No files matched your search
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
bool App::statistics_picker_select(const std::string &kind,const std::string &value) {
|
||||
if(menu_!="statistics"||!source_||statistics_trophy_.contains("asset"))return false;
|
||||
if(menu_!="statistics"||(!source_&&!engine_mode_)||statistics_trophy_.contains("asset"))return false;
|
||||
const auto items=statistics_picker_items(kind);
|
||||
if(std::none_of(items.begin(),items.end(),[&](const auto &item){return item.first==value;}))return false;
|
||||
statistics_remember_scroll();
|
||||
@@ -9,11 +9,12 @@ bool App::statistics_picker_select(const std::string &kind,const std::string &va
|
||||
const auto field=kind=="stat-section"?"section":kind=="stat-category"?"category":"country";
|
||||
statistics_view_[field]=std::stoi(value);
|
||||
}
|
||||
if(engine_mode_)engine_statistics_load();
|
||||
return true;
|
||||
}
|
||||
bool App::statistics_action(const std::string &action,Rml::Element *target) {
|
||||
if(!action.starts_with("statistics-"))return false;
|
||||
if(menu_!="statistics"||!source_)return true;
|
||||
if(menu_!="statistics"||(!source_&&!engine_mode_))return true;
|
||||
if(action=="statistics-trophy-close") {
|
||||
if(statistics_trophy_.contains("asset")) {
|
||||
focus_after_render_=statistics_trophy_.value("return_focus","");statistics_trophy_=Json::object();refresh();
|
||||
@@ -21,7 +22,7 @@ bool App::statistics_action(const std::string &action,Rml::Element *target) {
|
||||
return true;
|
||||
}
|
||||
if(!target||statistics_trophy_.contains("asset")||!report_detail_kind_.empty()||!report_picker_.empty())return true;
|
||||
const auto data=source_->read_statistics(statistics_view_);
|
||||
const auto data=statistics_data();
|
||||
if(!data.value("ok",false))return true;
|
||||
statistics_remember_scroll();
|
||||
if(action=="statistics-absolute"&&data.at("section")==2)statistics_view_["absolute"]=!data.at("absolute").get<bool>();
|
||||
@@ -44,6 +45,7 @@ bool App::statistics_action(const std::string &action,Rml::Element *target) {
|
||||
statistics_trophy_={{"asset",asset},{"title",title},{"winner",winner},{"season",entry.value("season",data.value("previous_season",""))},{"return_focus",target->GetId()}};
|
||||
focus_after_render_="statistics-trophy-close";
|
||||
} else return true;
|
||||
if(engine_mode_&&action!="statistics-trophy")engine_statistics_load();
|
||||
if(action!="statistics-trophy")focus_after_render_=target->GetId();
|
||||
refresh();return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user