master
Tomasz Golinski 2022-07-14 14:47:15 +02:00
rodzic d00a852295
commit 70499296d7
4 zmienionych plików z 53 dodań i 52 usunięć

Wyświetl plik

@ -872,8 +872,7 @@ int main(int argc, char** argv) {
std::cout << "<td class=\"dt_null\"></td>";
else
std::cout << "<td class=\"dt_zero\">" << 0 << "</td>";
}
else {
} else {
std::cout << "<td codes=\"" << codes << "\">" << count << "</td>";
n++;
m++;

Wyświetl plik

@ -162,10 +162,14 @@ bool OCdb::update_cache(const json& j) {
fields["type"] = j["data"]["type"].get<std::string>();
if (j["data"].count("status") && !j["data"]["status"].is_null()) {
std::string tmp = j["data"]["status"].get<std::string>();
if (tmp == "Available") fields2["status"] = ok;
else if (tmp == "Archived") fields2["status"] = archived;
else if (tmp == "Temporarily unavailable") fields2["status"] = disabled;
else fields2["status"] = unknown;
if (tmp == "Available")
fields2["status"] = ok;
else if (tmp == "Archived")
fields2["status"] = archived;
else if (tmp == "Temporarily unavailable")
fields2["status"] = disabled;
else
fields2["status"] = unknown;
}
if (j["data"].count("size2") && !j["data"]["size2"].is_null())
fields["size"] = j["data"]["size2"].get<std::string>();
@ -406,8 +410,10 @@ Caches OCdb::parse_sql_caches() const {
//c.country = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 6));
if (sqlite3_column_text(stmt, 7)) c.region = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 7));
if (sqlite3_column_text(stmt, 8)) c.owner_uuid = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 8)); // TODO: we don't know owner's nick
if (sqlite3_column_text(stmt, 9)) c.status = static_cast<Status>(sqlite3_column_int(stmt, 9));
else c.status = unknown;
if (sqlite3_column_text(stmt, 9))
c.status = static_cast<Status>(sqlite3_column_int(stmt, 9));
else
c.status = unknown;
if (sqlite3_column_text(stmt, 10)) c.name = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 10));
if (sqlite3_column_text(stmt, 11)) c.country = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 11));

Wyświetl plik

@ -78,7 +78,8 @@ void PowertrailDB::get_trail(uint n) {
T.name = res[1].str();
if (T.name.empty()) return;
Debug(2) << "Read name: " << T.name;
} else return;
} else
return;
if (std::regex_search(curl_output, res, regex_date) && res.size() == 2) {
strptime(res[1].str().c_str(), "%d-%m-%Y", &T.date);
T.date_str = res[1].str();
@ -157,7 +158,6 @@ void Caches_in_Powertrails::read_from_json(std::string file) {
json j;
datafile >> j;
data = j.get<std::unordered_map<std::string, int>>();
// data = j.get<Caches_in_Powertrails>();
}
catch (...) {
Debug(1) << "Cache file: " << file << " corrupted.";
@ -170,6 +170,3 @@ void Caches_in_Powertrails::save_to_json(std::string file) {
json j(data);
datafile << j;
};
// void Caches_in_Powertrails::update_caches(Caches& cc) {
// };

Wyświetl plik

@ -58,7 +58,6 @@ public:
void read_from_json(std::string file);
void save_to_json(std::string file);
// void update_caches(Caches& cc);
private:
};