Get ratings from OKapi

sql-rework
Tomasz Goliński 2020-08-28 17:38:28 +02:00
rodzic 3a3c275954
commit e6909c1575
2 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -62,6 +62,7 @@ public:
float terr = 0;
int fav = 0;
int founds = 0;
float rating = 0;
bool recommended = 0; // was the cache recommended by that user?
std::string type;
std::string region;

Wyświetl plik

@ -93,7 +93,7 @@ void Okapi::get_user_caches_json(const std::string& uuid, int count, int offset)
void Okapi::get_caches_json(const std::string& codes) const {
std::string service = url + OKAPI_caches;
std::string query = "consumer_key=" + key + "&cache_codes=" + codes + "&fields=code|name|location|type|status|difficulty|terrain|owner|region|size2|date_created|recommendations|founds|status";
std::string query = "consumer_key=" + key + "&cache_codes=" + codes + "&fields=code|name|location|type|status|difficulty|terrain|owner|region|size2|date_created|recommendations|rating|founds|status";
curl_post(service, query);
}
@ -157,6 +157,7 @@ Caches Okapi::get_caches(const std::set<std::string>& codes) const {
c.pos = Position(el.value()["location"]);
c.origin = service;
c.fav = el.value()["recommendations"];
if (!el.value()["rating"].is_null()) c.rating = el.value()["rating"];
c.founds = el.value()["founds"];
if (el.value()["status"] == "Available")