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

[status] suppress warning if no target was set

parent bccabdad
Pipeline #2764 canceled with stages
in 11 seconds
......@@ -123,7 +123,9 @@ public:
void increaseCounter(const Id& id)
{
count_[id.get()]++;
if (count_[id.get()] > targetCount_[id.get()])
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