// SPDX-License-Identifier: GPL-3.0-only Json App::statistics_data() const { if(engine_mode_)return engine_statistics_value_.is_object()?engine_statistics_value_:Json{{"ok",false}}; return source_?source_->read_statistics(statistics_view_):Json{{"ok",false}}; } void App::engine_statistics_load() { if(engine_busy_||engine_files_busy_||!engine_fresh_)return; if(engine_statistics_value_.is_object()&&engine_statistics_query_==statistics_view_){refresh();return;} const auto query=statistics_view_;auto link=engine_link_; engine_start("Statistik wird geladen …",[link,query]{const auto bundle=link->snapshot();return EngineReply{link,bundle,{{"messageType","reports_preview"},{"kind","statistics"},{"query",query},{"read",link->read({{"kind","statistics"},{"query",query}})}},nullptr};}); } bool App::engine_statistics_player(const std::string &id,Rml::Element *target) { if(!engine_statistics_value_.is_object())return false; for(const auto &row:engine_statistics_value_.at("rows"))for(const auto &cell:row.at("cells"))if(cell.value("player","")==id) { std::string team=cell.value("club",""),name="—"; for(const auto &other:row.at("cells"))if(other.contains("club")||other.contains("nation")){team=other.value("club",other.value("nation",std::string()));name=other.value("text",std::string("—"));break;} const auto *player=world_->find("players",id);std::string photo; if(player&&player->value("photo",Json()).is_string())photo=player->at("photo"); if(photo.empty())photo="asset:player/"+(id.starts_with("player:")?id.substr(7):id)+"/photo"; engine_rankings_player_={{"player",id},{"name",cell.at("text")},{"club",team},{"club_name",name},{"photo",photo},{"currentTeam",nullptr},{"archive_label","Archivmannschaft"},{"source_caption","Archivaufzeichnung"}}; report_detail_player_=id;report_detail_club_=team;report_detail_kind_="player";report_detail_return_focus_=target->GetId();focus_after_render_="report-detail-close";close_report_picker(false);refresh();return true; } return false; }