Commit 00c15719 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

Merge branch 'feature/improve-status' into 'master'

[status] suppress warning if no target was set

Closes #22

See merge request tools/frackit!201
parents f96f3da2 61585484
Pipeline #2765 passed with stages
in 13 minutes and 24 seconds
......@@ -123,8 +123,10 @@ public:
void increaseCounter(const Id& id)
{
count_[id.get()]++;
if (count_[id.get()] > targetCount_[id.get()])
std::cout << "Warning: target count for id " << id.get() << " was surpassed" << std::endl;
if (auto it = targetCount_.find(id.get()); it != targetCount_.end())
if (count_[id.get()] > it->second)
std::cout << "Warning: target count for id " << id.get() << " was surpassed" << std::endl;
}
/*!
......@@ -230,12 +232,14 @@ public:
for (const auto& pair : targetCount_) curTargetCount += pair.second;
for (const auto& pair : rejectedCount_) curRejectedCount += pair.second;
const bool hasProgess = curTargetCount > 0;
const auto ratio = 100.0*double(double(curCount)/double(curCount+curRejectedCount));
const auto progress = 100.0*double(curCount)/double(curTargetCount);
const auto progress = hasProgess ? 100.0*double(curCount)/double(curTargetCount) : 0.0;
std::cout << std::setprecision(2) << std::fixed;
const auto ratioNumChars = std::to_string(int(ratio)).size() + 3;
const auto progressNumChars = std::to_string(int(progress)).size() + 3;
const auto progressNumChars = hasProgess ? std::to_string(int(progress)).size() + 3
: std::string("n.a.").size() + 3;
const auto countString = std::to_string(curCount);
const auto rejectedCountString = std::to_string(curRejectedCount);
......@@ -250,7 +254,7 @@ public:
std::cout << " " << std::string( paddingCount, ' ') << countString + ' '
<< " | " << std::string( paddingRejected, ' ') << rejectedCountString + ' '
<< " | " << std::string( paddingRatio, ' ') << ratio << std::string(4, ' ')
<< " | " << std::string( paddingProgess, ' ') << progress << std::endl;
<< " | " << std::string( paddingProgess, ' ') << (hasProgess ? std::to_string(progress) : "n.a.") << std::endl;
}
/*!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment