kopia lustrzana https://gitlab.com/tomaszg/geostat
Sort FTFs by find date, add events, use date_hidden
rodzic
2a2a77caf3
commit
2e08a99d20
|
@ -722,7 +722,7 @@ int main(int argc, char** argv) {
|
|||
std::cout << "<th>Cache</th>";
|
||||
std::cout << "<th>Type</th>";
|
||||
std::cout << "<th>Region</th>";
|
||||
std::cout << "<th>Date hidden</th>";
|
||||
std::cout << "<th>Date found</th>";
|
||||
std::cout << "<th>Finds</th>";
|
||||
std::cout << "</tr>\n";
|
||||
|
||||
|
@ -733,7 +733,7 @@ int main(int argc, char** argv) {
|
|||
std::cout << "<td>" << i->link_name() << "</td>";
|
||||
std::cout << "<td>" << i->type << "</td>";
|
||||
std::cout << "<td>" << i->region << "</td>";
|
||||
std::cout << "<td>" << i->date_hidden << "</td>";
|
||||
std::cout << "<td>" << i->date << "</td>";
|
||||
std::cout << "<td>" << i->founds << "</td>";
|
||||
std::cout << "</tr>\n";
|
||||
n++;
|
||||
|
|
|
@ -104,7 +104,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 api_service = url + OKAPI_caches;
|
||||
std::string query = "consumer_key=" + key + "&cache_codes=" + codes + "&fields=code|name|location|type|status|difficulty|terrain|owner|region|country2|size2|date_created|recommendations|rating|founds|status|internal_id";
|
||||
std::string query = "consumer_key=" + key + "&cache_codes=" + codes + "&fields=code|name|location|type|status|difficulty|terrain|owner|region|country2|size2|date_hidden|recommendations|rating|founds|status|internal_id";
|
||||
curl_post(api_service, query);
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ Caches Okapi::get_caches(const std::set<std::string>& codes) const {
|
|||
c.status = unknown;
|
||||
|
||||
std::tm tmp;
|
||||
std::stringstream ss(el.value()["date_created"].get<std::string>());
|
||||
std::stringstream ss(el.value()["date_hidden"].get<std::string>());
|
||||
ss >> std::get_time(&tmp, "%Y-%m-%dT%H:%M:%S+");
|
||||
tmp.tm_isdst = -1;
|
||||
c.set_date_hidden(tmp);
|
||||
|
@ -224,7 +224,7 @@ Caches Okapi::get_user_caches(const std::string& uuid, int count) const {
|
|||
j = json::parse(curl_output);
|
||||
|
||||
for (auto& el : j.items()) {
|
||||
if (el.value()["type"] == "Found it") {
|
||||
if (el.value()["type"] == "Found it" || el.value()["type"] == "Attended") {
|
||||
std::stringstream ss(el.value()["date"].get<std::string>());
|
||||
// TODO need to take care of the time zone :/
|
||||
ss >> std::get_time(&date, "%Y-%m-%dT%H:%M:%S+");
|
||||
|
@ -242,7 +242,7 @@ Caches Okapi::get_user_caches(const std::string& uuid, int count) const {
|
|||
j = json::parse(curl_output);
|
||||
|
||||
for (auto& el : j.items()) {
|
||||
if (el.value()["type"] == "Found it") {
|
||||
if (el.value()["type"] == "Found it" || el.value()["type"] == "Attended") {
|
||||
std::stringstream ss(el.value()["date"].get<std::string>());
|
||||
ss >> std::get_time(&date, "%Y-%m-%dT%H-%M-%S");
|
||||
date.tm_isdst = -1;
|
||||
|
|
1
user.cpp
1
user.cpp
|
@ -188,6 +188,7 @@ void User::prepare_lists_of_caches() {
|
|||
std::sort(caches_by_fav_perc.begin(), caches_by_fav_perc.end(), [&](const Cache* a, const Cache* b) { return 1.0 * a->fav / a->founds > 1.0 * b->fav / b->founds; });
|
||||
std::sort(caches_by_finds.begin(), caches_by_finds.end(), [&](const Cache* a, const Cache* b) { return a->founds > b->founds; });
|
||||
// std::sort(caches_by_rating.begin(), caches_by_rating.end(), [&](const Cache* a, const Cache* b) { return a->rating > b->rating; });
|
||||
std::sort(caches_ftf.begin(), caches_ftf.end(), [&](const Cache* a, const Cache* b) { return a->date_t < b->date_t; });
|
||||
} else {
|
||||
for (auto& i : cc) {
|
||||
if (i.type != "Moving" && i.type != "Own" && (!exclude_quiz || i.type != "Quiz")) {
|
||||
|
|
Ładowanie…
Reference in New Issue