kopia lustrzana https://gitlab.com/tomaszg/geostat
Fix a mess caused by coping too big block of code
rodzic
1c2bcf0cdc
commit
fe16f07dd7
54
geostat.cpp
54
geostat.cpp
|
@ -336,9 +336,6 @@ int main(int argc, char** argv) {
|
|||
short count;
|
||||
int n = 0;
|
||||
|
||||
short y_min = std::min_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_hidden_tm.tm_year < b.date_hidden_tm.tm_year; })->date_hidden_tm.tm_year;
|
||||
short y_max = std::max_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_hidden_tm.tm_year < b.date_hidden_tm.tm_year; })->date_hidden_tm.tm_year;
|
||||
|
||||
std::cout << "<div class=\"basic_stats\">\n";
|
||||
std::cout << "Number of caches found: <span class=\"value\">" << cc.size() << "</span><br>\n";
|
||||
|
||||
|
@ -375,31 +372,10 @@ int main(int argc, char** argv) {
|
|||
auto E = *std::max_element(fcc.begin(), fcc.end(), [&](const Cache* a, const Cache* b) { return a->pos.lon < b->pos.lon; });
|
||||
auto W = *std::min_element(fcc.begin(), fcc.end(), [&](const Cache* a, const Cache* b) { return a->pos.lon < b->pos.lon; });
|
||||
|
||||
short y_min = std::min_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_tm.tm_year < b.date_tm.tm_year; })->date_tm.tm_year;
|
||||
short y_max = std::max_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_tm.tm_year < b.date_tm.tm_year; })->date_tm.tm_year;
|
||||
|
||||
std::cout << "<h2>Caching timeline</h2>\n";
|
||||
std::cout << "<table class=\"dt\">\n";
|
||||
std::cout << "<tr><th></th>";
|
||||
for (int j = 1; j <= 12; j++) { // print table month headers
|
||||
std::cout << "<th>" << j << "</th>";
|
||||
}
|
||||
std::cout << "</tr>\n";
|
||||
|
||||
for (int i = y_min; i <= y_max; i++) { // i -> years in rows
|
||||
std::cout << "<tr><th>" << i + 1900 << "</th> ";
|
||||
for (int j = 1; j <= 12; j++) { // j -> months in cols
|
||||
count = std::count_if(cc.begin(), cc.end(), [i, j](Cache c) { return (c.date_hidden_tm.tm_year == i && c.date_hidden_tm.tm_mon == j - 1); });
|
||||
if (count == 0)
|
||||
std::cout << "<td class=\"dt_zero\">" << 0 << "</td>";
|
||||
else
|
||||
std::cout << "<td>" << count << "</td>";
|
||||
}
|
||||
std::cout << "</tr>\n";
|
||||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
y_min = std::min_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_tm.tm_year < b.date_tm.tm_year; })->date_tm.tm_year;
|
||||
y_max = std::max_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_tm.tm_year < b.date_tm.tm_year; })->date_tm.tm_year;
|
||||
|
||||
std::cout << "<h2>Caches by found day matrix</h2>\n";
|
||||
std::cout << "<table class=\"calendar_tab\">\n";
|
||||
std::cout << "<tr><th></th>";
|
||||
for (int j = 1; j <= 12; j++) { // print table month headers
|
||||
|
@ -650,6 +626,30 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
y_min = std::min_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_hidden_tm.tm_year < b.date_hidden_tm.tm_year; })->date_hidden_tm.tm_year;
|
||||
y_max = std::max_element(cc.begin(), cc.end(), [&](const Cache& a, const Cache& b) { return a.date_hidden_tm.tm_year < b.date_hidden_tm.tm_year; })->date_hidden_tm.tm_year;
|
||||
|
||||
std::cout << "<h2>Caches by hidden day matrix</h2>\n";
|
||||
std::cout << "<table class=\"dt\">\n";
|
||||
std::cout << "<tr><th></th>";
|
||||
for (int j = 1; j <= 12; j++) { // print table month headers
|
||||
std::cout << "<th>" << j << "</th>";
|
||||
}
|
||||
std::cout << "</tr>\n";
|
||||
|
||||
for (int i = y_min; i <= y_max; i++) { // i -> years in rows
|
||||
std::cout << "<tr><th>" << i + 1900 << "</th> ";
|
||||
for (int j = 1; j <= 12; j++) { // j -> months in cols
|
||||
count = std::count_if(cc.begin(), cc.end(), [i, j](Cache c) { return (c.date_hidden_tm.tm_year == i && c.date_hidden_tm.tm_mon == j - 1); });
|
||||
if (count == 0)
|
||||
std::cout << "<td class=\"dt_zero\">" << 0 << "</td>";
|
||||
else
|
||||
std::cout << "<td>" << count << "</td>";
|
||||
}
|
||||
std::cout << "</tr>\n";
|
||||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
} // end of main if
|
||||
|
||||
if (get_not_found) {
|
||||
|
|
Ładowanie…
Reference in New Issue