This PR addresses an issue where the admin dashboard was incorrectly displaying 0% for the percentages of users with 2FA enabled and those with PGP keys set. The calculations now correctly reflect the actual percentages based on the total user count.
Problem
Incorrect Percentage Display: The percentages for 2FA and PGP key usage were always showing as 0%, regardless of the actual data.
Cause
Order of Variable Assignment: The user_count variable, representing the total number of users, was being assigned after the percentage calculations. As a result, user_count was None at the time of calculation, leading to incorrect percentages.
Solution
Reordered Variable Assignments: Moved the assignment of user_count to occur before calculating two_fa_percentage and pgp_key_percentage. This ensures user_count has a valid value during percentage calculations.
This PR addresses an issue where the admin dashboard was incorrectly displaying 0% for the percentages of users with 2FA enabled and those with PGP keys set. The calculations now correctly reflect the actual percentages based on the total user count.
Problem Incorrect Percentage Display: The percentages for 2FA and PGP key usage were always showing as 0%, regardless of the actual data.
Cause Order of Variable Assignment: The
user_count variable
, representing the total number of users, was being assigned after the percentage calculations. As a result,user_count
was None at the time of calculation, leading to incorrect percentages.Solution
user_count
to occur before calculatingtwo_fa_percentage
andpgp_key_percentage
. This ensuresuser_count
has a valid value during percentage calculations.