Do not include in the tables days that are not in the calendar

sql-rework
Tomasz Golinski 2020-03-30 02:10:56 +02:00
rodzic dcbd57e22e
commit babd56a70f
1 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -470,9 +470,12 @@ int main(int argc, char** argv) {
std::cout << "<tr><th>" << i << "</th> ";
for (int j = 1; j <= 31; j++) { // j -> days in cols
count = std::count_if(cc.begin(), cc.end(), [i, j](Cache c) { return (c.date_tm.tm_mon == i - 1 && c.date_tm.tm_mday == j); });
if (count == 0)
std::cout << "<td class=\"dt_zero\">" << 0 << "</td>";
else
if (count == 0) {
if ((j == 31 && (i == 2 || i == 4 || i == 6 || i == 9 || i == 11)) || (j == 30 && i == 2))
std::cout << "<td class=\"dt_null\"></td>";
else
std::cout << "<td class=\"dt_zero\">" << 0 << "</td>";
} else
std::cout << "<td>" << count << "</td>";
}
std::cout << "</tr>\n";