kopia lustrzana https://gitlab.com/tomaszg/geostat
Include stats for hidden month matrix
rodzic
cfbacb2c0d
commit
5f6f8c7acc
24
geostat.cpp
24
geostat.cpp
|
@ -792,6 +792,9 @@ int main(int argc, char** argv) {
|
|||
std::cout << "Total <span class=\"value\">" << n << "</span> days out of 366 (" << std::setprecision(3) << n / 3.66 << "%).\n";
|
||||
std::cout << "</div>\n";
|
||||
|
||||
// Hidden months matrix
|
||||
n = 0;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -809,13 +812,30 @@ int main(int argc, char** argv) {
|
|||
count = count_caches(cc, codes, [i, j](const Cache& c) -> bool { 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
|
||||
else {
|
||||
std::cout << "<td codes=\"" << codes << "\">" << count << "</td>";
|
||||
n++;
|
||||
}
|
||||
}
|
||||
std::cout << "</tr>\n";
|
||||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
std::time_t now = std::time(nullptr);
|
||||
std::tm* now_tm = std::localtime(&now);
|
||||
if (now_tm) {
|
||||
if (!ocpl_user_uuid.empty() && !ocde_user_uuid.empty()) {
|
||||
int m_count = (now_tm->tm_year - 106) * 12 + 8 + now_tm->tm_mon + 1; // 106 corresponds to 2006, 8 is no. of months since may till dec, +1 since tm_mon starts at 0
|
||||
std::cout << "<div class=\"basic_stats\">\n";
|
||||
std::cout << "Total <span class=\"value\">" << n << "</span> months out of " << m_count << " (" << std::setprecision(3) << n * 1.0 / m_count << "%).\n";
|
||||
std::cout << "</div>\n";
|
||||
} else if (!ocde_user_uuid.empty()) {
|
||||
int m_count = (now_tm->tm_year - 105) * 12 + 5 + now_tm->tm_mon + 1; // 106 corresponds to 2005, 8 is no. of months since aug till dec, +1 since tm_mon starts at 0
|
||||
std::cout << "<div class=\"basic_stats\">\n";
|
||||
std::cout << "Total <span class=\"value\">" << n << "</span> months out of " << m_count << " (" << std::setprecision(3) << n * 1.0 / m_count << "%).\n";
|
||||
std::cout << "</div>\n";
|
||||
}
|
||||
}
|
||||
} // end of main if
|
||||
|
||||
if (get_not_found) {
|
||||
|
@ -831,7 +851,7 @@ int main(int argc, char** argv) {
|
|||
for (auto& i : region_count)
|
||||
if (i.second != 0) i.second = region_found_count[i.first] * 100 / i.second;
|
||||
show_histogram(region_count, "Percentage", 1);
|
||||
}
|
||||
} // end of "not found" if
|
||||
|
||||
if (get_owned) {
|
||||
short count;
|
||||
|
|
Ładowanie…
Reference in New Issue