From ba6fc72bcda0214bc4f6894dd999f254ee6e1478 Mon Sep 17 00:00:00 2001 From: Scott Date: Fri, 28 Oct 2016 13:14:13 -0400 Subject: [PATCH 1/2] Metrics - Don't exclaim unless > 1 "You have validated 0 transactions!" sounds a little less enthusiastic that intended. Also, only says "1 transaction". --- src/metrics.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/metrics.cpp b/src/metrics.cpp index a5480838e..875260dd9 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -94,6 +94,7 @@ int printMetrics(size_t cols, int64_t nStart, bool mining) int hours = (uptime - (days * 24 * 60 * 60)) / (60 * 60); int minutes = (uptime - (((days * 24) + hours) * 60 * 60)) / 60; int seconds = uptime - (((((days * 24) + hours) * 60) + minutes) * 60); + int validatedCount = 0; // Display uptime std::string duration; @@ -110,7 +111,14 @@ int printMetrics(size_t cols, int64_t nStart, bool mining) std::cout << strDuration << std::endl; lines += (strDuration.size() / cols); - std::cout << "- " << strprintf(_("You have validated %d transactions!"), transactionsValidated.get()) << std::endl; + validatedCount = transactionsValidated.get(); + if (validatedCount > 1) { + std::cout << "- " << strprintf(_("You have validated %d transactions!"), validatedCount) << std::endl; + } else if (validatedCount == 1) { + std::cout << "- " << strprintf(_("You have validated %d transaction."), validatedCount) << std::endl; + } else { + std::cout << "- " << strprintf(_("You have validated %d transactions."), validatedCount) << std::endl; + } if (mining) { double solps = uptime > 0 ? (double)solutionTargetChecks.get() / uptime : 0; From 1c8d5c406143f76a3053db6acacc3b6cc7fed5b3 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 1 Dec 2016 15:34:57 +1300 Subject: [PATCH 2/2] Address review comments, tweak strings --- src/metrics.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/metrics.cpp b/src/metrics.cpp index 875260dd9..fe9795920 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -94,7 +94,6 @@ int printMetrics(size_t cols, int64_t nStart, bool mining) int hours = (uptime - (days * 24 * 60 * 60)) / (60 * 60); int minutes = (uptime - (((days * 24) + hours) * 60 * 60)) / 60; int seconds = uptime - (((((days * 24) + hours) * 60) + minutes) * 60); - int validatedCount = 0; // Display uptime std::string duration; @@ -111,13 +110,13 @@ int printMetrics(size_t cols, int64_t nStart, bool mining) std::cout << strDuration << std::endl; lines += (strDuration.size() / cols); - validatedCount = transactionsValidated.get(); + int validatedCount = transactionsValidated.get(); if (validatedCount > 1) { std::cout << "- " << strprintf(_("You have validated %d transactions!"), validatedCount) << std::endl; } else if (validatedCount == 1) { - std::cout << "- " << strprintf(_("You have validated %d transaction."), validatedCount) << std::endl; + std::cout << "- " << _("You have validated a transaction!") << std::endl; } else { - std::cout << "- " << strprintf(_("You have validated %d transactions."), validatedCount) << std::endl; + std::cout << "- " << _("You have validated no transactions.") << std::endl; } if (mining) {