From 66f5a8736a5c5cf62a2127b22c662329e8f6a29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfram=20R=C3=B6sler?= Date: Wed, 23 Dec 2020 13:02:15 +0100 Subject: [PATCH] Statistics: Fix average password length The average password length shown in the Statistics report is now computed based on the total number of passwords. Previously, it was erroneously computed based on the number of unique passwords. Fixes #5134. --- src/gui/reports/ReportsWidgetStatistics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/reports/ReportsWidgetStatistics.cpp b/src/gui/reports/ReportsWidgetStatistics.cpp index 400d82f29..976124a42 100644 --- a/src/gui/reports/ReportsWidgetStatistics.cpp +++ b/src/gui/reports/ReportsWidgetStatistics.cpp @@ -58,7 +58,8 @@ namespace // Get average password length int averagePwdLength() const { - return m_passwords.empty() ? 0 : pwdTotalLen / m_passwords.size(); + const auto nPwds = nPwdsUnique + nPwdsReused; + return nPwds == 0 ? 0 : std::round(pwdTotalLen / double(nPwds)); } // Get max number of password reuse (=how many entries