Fix more trivial mistakes in calculations

master
Tomasz Golinski 2021-05-06 00:15:43 +02:00
rodzic a76df5e753
commit 43aebec5fd
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -825,14 +825,14 @@ int main(int argc, char** argv) {
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
int m_count = (now_tm->tm_year - 106 - 1) * 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 << "Total <span class=\"value\">" << n << "</span> months out of " << m_count << " (" << std::setprecision(3) << n * 100.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
int m_count = (now_tm->tm_year - 105 - 1) * 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 << "Total <span class=\"value\">" << n << "</span> months out of " << m_count << " (" << std::setprecision(3) << n * 100.0 / m_count << "%).\n";
std::cout << "</div>\n";
}
}