Fetch regions and print out histogram

sql-rework
Tomasz Golinski 2019-09-12 13:58:54 +02:00
rodzic 25b407f02f
commit 1942df93e5
3 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -46,6 +46,7 @@ public:
float diff;
float terr;
std::string type;
std::string region;
std::string origin;
std::string owner;
std::string owner_uuid;

Wyświetl plik

@ -197,8 +197,11 @@ int main(int argc, char** argv) {
std::cout << "Types:\n";
show_histogram(&cc, &Cache::type);
std::cout << "\nService:\n";
std::cout << "\nServices:\n";
show_histogram(&cc, &Cache::origin);
std::cout << "\nRegions:\n";
show_histogram(&cc, &Cache::region);
}
if (show_dt) {

Wyświetl plik

@ -72,7 +72,7 @@ std::string Okapi::get_user_caches_json(std::string uuid, int count, int offset)
std::string Okapi::get_caches_json(std::string codes) {
std::string service = url + OKAPI_caches;
std::string query = "consumer_key=" + key + "&cache_codes=" + codes + "&fields=code|name|location|type|status|difficulty|terrain|owner";
std::string query = "consumer_key=" + key + "&cache_codes=" + codes + "&fields=code|name|location|type|status|difficulty|terrain|owner|region";
return curl_post(service, query);
}
@ -120,6 +120,7 @@ Caches Okapi::get_caches(std::vector<std::string> codes) {
c.code = el.value()["code"];
c.name = el.value()["name"];
c.type = el.value()["type"];
c.region = el.value()["region"];
c.diff = el.value()["difficulty"];
c.terr = el.value()["terrain"];
c.owner = el.value()["owner"]["username"];