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.
This commit is contained in:
Wolfram Rösler 2020-12-23 13:02:15 +01:00 committed by Jonathan White
parent 14b01784ec
commit 66f5a8736a

View File

@ -58,7 +58,8 @@ namespace
// Get average password length // Get average password length
int averagePwdLength() const 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 // Get max number of password reuse (=how many entries