kopia lustrzana https://gitlab.com/tomaszg/geostat
clang-format
rodzic
d00a852295
commit
70499296d7
|
@ -872,8 +872,7 @@ int main(int argc, char** argv) {
|
||||||
std::cout << "<td class=\"dt_null\"></td>";
|
std::cout << "<td class=\"dt_null\"></td>";
|
||||||
else
|
else
|
||||||
std::cout << "<td class=\"dt_zero\">" << 0 << "</td>";
|
std::cout << "<td class=\"dt_zero\">" << 0 << "</td>";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
std::cout << "<td codes=\"" << codes << "\">" << count << "</td>";
|
std::cout << "<td codes=\"" << codes << "\">" << count << "</td>";
|
||||||
n++;
|
n++;
|
||||||
m++;
|
m++;
|
||||||
|
|
18
ocdb.cpp
18
ocdb.cpp
|
@ -162,10 +162,14 @@ bool OCdb::update_cache(const json& j) {
|
||||||
fields["type"] = j["data"]["type"].get<std::string>();
|
fields["type"] = j["data"]["type"].get<std::string>();
|
||||||
if (j["data"].count("status") && !j["data"]["status"].is_null()) {
|
if (j["data"].count("status") && !j["data"]["status"].is_null()) {
|
||||||
std::string tmp = j["data"]["status"].get<std::string>();
|
std::string tmp = j["data"]["status"].get<std::string>();
|
||||||
if (tmp == "Available") fields2["status"] = ok;
|
if (tmp == "Available")
|
||||||
else if (tmp == "Archived") fields2["status"] = archived;
|
fields2["status"] = ok;
|
||||||
else if (tmp == "Temporarily unavailable") fields2["status"] = disabled;
|
else if (tmp == "Archived")
|
||||||
else fields2["status"] = unknown;
|
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())
|
if (j["data"].count("size2") && !j["data"]["size2"].is_null())
|
||||||
fields["size"] = j["data"]["size2"].get<std::string>();
|
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));
|
//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, 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, 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));
|
if (sqlite3_column_text(stmt, 9))
|
||||||
else c.status = unknown;
|
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, 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));
|
if (sqlite3_column_text(stmt, 11)) c.country = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 11));
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,8 @@ void PowertrailDB::get_trail(uint n) {
|
||||||
T.name = res[1].str();
|
T.name = res[1].str();
|
||||||
if (T.name.empty()) return;
|
if (T.name.empty()) return;
|
||||||
Debug(2) << "Read name: " << T.name;
|
Debug(2) << "Read name: " << T.name;
|
||||||
} else return;
|
} else
|
||||||
|
return;
|
||||||
if (std::regex_search(curl_output, res, regex_date) && res.size() == 2) {
|
if (std::regex_search(curl_output, res, regex_date) && res.size() == 2) {
|
||||||
strptime(res[1].str().c_str(), "%d-%m-%Y", &T.date);
|
strptime(res[1].str().c_str(), "%d-%m-%Y", &T.date);
|
||||||
T.date_str = res[1].str();
|
T.date_str = res[1].str();
|
||||||
|
@ -157,7 +158,6 @@ void Caches_in_Powertrails::read_from_json(std::string file) {
|
||||||
json j;
|
json j;
|
||||||
datafile >> j;
|
datafile >> j;
|
||||||
data = j.get<std::unordered_map<std::string, int>>();
|
data = j.get<std::unordered_map<std::string, int>>();
|
||||||
// data = j.get<Caches_in_Powertrails>();
|
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
Debug(1) << "Cache file: " << file << " corrupted.";
|
Debug(1) << "Cache file: " << file << " corrupted.";
|
||||||
|
@ -170,6 +170,3 @@ void Caches_in_Powertrails::save_to_json(std::string file) {
|
||||||
json j(data);
|
json j(data);
|
||||||
datafile << j;
|
datafile << j;
|
||||||
};
|
};
|
||||||
|
|
||||||
// void Caches_in_Powertrails::update_caches(Caches& cc) {
|
|
||||||
// };
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ public:
|
||||||
|
|
||||||
void read_from_json(std::string file);
|
void read_from_json(std::string file);
|
||||||
void save_to_json(std::string file);
|
void save_to_json(std::string file);
|
||||||
// void update_caches(Caches& cc);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue