scidsg / hushline

Hush Line connects whistleblowers with organizations and people who can help.
https://hushline.app
GNU Affero General Public License v3.0
77 stars 21 forks source link

Fix Percentage Calculations for 2FA and PGP in Admin Dashboard #675

Closed glenn-sorrentino closed 1 month ago

glenn-sorrentino commented 1 month ago

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.

Screenshot 2024-10-08 at 6 54 03 PM

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

Screenshot 2024-10-08 at 6 50 01 PM