kopia lustrzana https://gitlab.com/tomaszg/geostat
Precompute treshold for powertrails, note rounding is always up
rodzic
6706ef9898
commit
30d38d8fc4
|
@ -32,6 +32,8 @@ void from_json(const json& j, Powertrail& item) {
|
||||||
j.at("caches").get_to(item.caches);
|
j.at("caches").get_to(item.caches);
|
||||||
j.at("type").get_to(item.type);
|
j.at("type").get_to(item.type);
|
||||||
strptime(item.date_str.c_str(), "%d-%m-%Y", &item.date);
|
strptime(item.date_str.c_str(), "%d-%m-%Y", &item.date);
|
||||||
|
item.treshold = (item.caches.size() * item.treshold_perc + 99) / 100; // Integer division rounding up
|
||||||
|
item.active_caches_not_found = item.active_caches;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Powertrail::link() const {
|
std::string Powertrail::link() const {
|
||||||
|
@ -132,6 +134,8 @@ void PowertrailDB::get_trail(uint n) {
|
||||||
T.active_caches++;
|
T.active_caches++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T.treshold = (T.caches.size() * T.treshold_perc + 99) / 100; // Integer division rounding up
|
||||||
|
|
||||||
data.insert({ n, T });
|
data.insert({ n, T });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ public:
|
||||||
std::tm date;
|
std::tm date;
|
||||||
std::string date_str;
|
std::string date_str;
|
||||||
uint treshold_perc;
|
uint treshold_perc;
|
||||||
|
uint treshold;
|
||||||
std::unordered_set<std::string> caches;
|
std::unordered_set<std::string> caches;
|
||||||
|
|
||||||
uint active_caches = 0;
|
uint active_caches = 0;
|
||||||
|
|
Ładowanie…
Reference in New Issue