kopia lustrzana https://gitlab.com/tomaszg/geostat
Fix rounding and optimize code a bit
rodzic
70499296d7
commit
add9b37d2a
|
@ -197,19 +197,20 @@ int main(int argc, char** argv) {
|
|||
t.read_from_json("powertrails.json");
|
||||
tc.read_from_json("caches_in_power.json");
|
||||
|
||||
std::unordered_map<int, const Powertrail*> tt_map; // Needed to deduplicate trails
|
||||
std::unordered_map<int, Powertrail*> tt_map; // Needed to deduplicate trails
|
||||
|
||||
for (auto& c : tmp) {
|
||||
if (tc.data.count(c.code) > 0) {
|
||||
c.trail = tc.data[c.code];
|
||||
t.data[c.trail].found++;
|
||||
if (t.data[c.trail].found >= t.data[c.trail].caches.size() * t.data[c.trail].treshold_perc / 100)
|
||||
t.data[c.trail].completed = 1;
|
||||
tt_map[c.trail] = &(t.data[c.trail]);
|
||||
}
|
||||
}
|
||||
for (const auto& i : tt_map)
|
||||
for (const auto& i : tt_map) {
|
||||
if (i.second->found * 100 >= i.second->caches.size() * i.second->treshold_perc )
|
||||
i.second->completed = 1;
|
||||
tt.push_back(i.second);
|
||||
}
|
||||
std::sort(tt.begin(), tt.end(), [&](const auto& a, const auto& b) { return 1.0 * a->found / a->caches.size() > 1.0 * b->found / b->caches.size(); });
|
||||
|
||||
OCpl.get_ftf(uid, tmp);
|
||||
|
|
Ładowanie…
Reference in New Issue