kopia lustrzana https://gitlab.com/tomaszg/geostat
Display rating stats
rodzic
e6909c1575
commit
cf48fc55c8
44
geostat.cpp
44
geostat.cpp
|
@ -286,6 +286,7 @@ int main(int argc, char** argv) {
|
|||
pCaches caches_by_fav;
|
||||
pCaches caches_by_fav_perc;
|
||||
pCaches caches_by_finds;
|
||||
pCaches caches_by_rating;
|
||||
pCaches fcc;
|
||||
|
||||
if (!get_not_found) {
|
||||
|
@ -307,12 +308,14 @@ int main(int argc, char** argv) {
|
|||
caches_by_fav.push_back(&*i);
|
||||
caches_by_fav_perc.push_back(&*i);
|
||||
caches_by_finds.push_back(&*i);
|
||||
caches_by_rating.push_back(&*i);
|
||||
|
||||
i++;
|
||||
}
|
||||
std::sort(caches_by_fav.begin(), caches_by_fav.end(), [&](const Cache* a, const Cache* b) { return a->fav > b->fav; });
|
||||
std::sort(caches_by_fav_perc.begin(), caches_by_fav_perc.end(), [&](const Cache* a, const Cache* b) { return 1.0 * a->fav / a->founds > 1.0 * b->fav / b->founds; });
|
||||
std::sort(caches_by_finds.begin(), caches_by_finds.end(), [&](const Cache* a, const Cache* b) { return a->founds > b->founds; });
|
||||
std::sort(caches_by_rating.begin(), caches_by_rating.end(), [&](const Cache* a, const Cache* b) { return a->rating > b->rating; });
|
||||
} else {
|
||||
for (auto& i : cc) {
|
||||
if (i.type != "Moving" && i.type != "Own" && (!exclude_quiz || i.type != "Quiz")) {
|
||||
|
@ -600,6 +603,31 @@ int main(int argc, char** argv) {
|
|||
|
||||
n = 1;
|
||||
|
||||
std::cout << "<h2>Caches with highest rating</h2>\n";
|
||||
std::cout << "<table class=\"list\">\n";
|
||||
std::cout << "<tr><th></th>";
|
||||
std::cout << "<th>Cache</th>";
|
||||
std::cout << "<th>Type</th>";
|
||||
std::cout << "<th>Rating</th>";
|
||||
std::cout << "<th>Finds</th>";
|
||||
std::cout << "</tr>\n";
|
||||
|
||||
for (auto i : caches_by_rating) {
|
||||
std::cout << "<tr><th>" << n << "</th> ";
|
||||
std::cout << "<td>" << i->link_name() << "</td>";
|
||||
std::cout << "<td>" << i->type << "</td>";
|
||||
std::cout << "<td>" << i->rating << "</td>";
|
||||
std::cout << "<td>" << i->founds << "</td>";
|
||||
std::cout << "</tr>\n";
|
||||
n++;
|
||||
if (n > LIST_MAX) break;
|
||||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
average_html(cc, &Cache::rating, "rating");
|
||||
|
||||
n = 1;
|
||||
|
||||
std::cout << "<h2>Caches with most finds</h2>\n";
|
||||
std::cout << "<table class=\"list\">\n";
|
||||
std::cout << "<tr><th></th>";
|
||||
|
@ -874,6 +902,22 @@ int main(int argc, char** argv) {
|
|||
|
||||
n = 1;
|
||||
|
||||
for (auto i : caches_by_rating) {
|
||||
std::cout << "<tr><th>" << n << "</th> ";
|
||||
std::cout << "<td>" << i->link_name() << "</td>";
|
||||
std::cout << "<td>" << i->type << "</td>";
|
||||
std::cout << "<td>" << i->rating << "</td>";
|
||||
std::cout << "<td>" << i->founds << "</td>";
|
||||
std::cout << "</tr>\n";
|
||||
n++;
|
||||
if (n > LIST_MAX) break;
|
||||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
average_html(cc, &Cache::rating, "rating");
|
||||
|
||||
n = 1;
|
||||
|
||||
std::cout << "<h2>Caches with most finds</h2>\n";
|
||||
std::cout << "<table class=\"list\">\n";
|
||||
std::cout << "<tr><th></th>";
|
||||
|
|
Ładowanie…
Reference in New Issue