Sohail: Fix role distribution chart to show complete roles data#2078
Open
sohailuddinsyed wants to merge 1 commit intodevelopmentfrom
Open
Sohail: Fix role distribution chart to show complete roles data#2078sohailuddinsyed wants to merge 1 commit intodevelopmentfrom
sohailuddinsyed wants to merge 1 commit intodevelopmentfrom
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
(PRIORITY HIGH) Yagna: Role Distribution Showing Incomplete Role Data
a. Owner Login → Dashboard → Role Distribution.
b. The Role Distribution chart currently displays only two roles, even though multiple roles exist in the system.
c. As per expected behavior, the chart should display all available roles along with their correct counts and percentages.
d. This leads to inaccurate or misleading reporting, as several existing roles are not included in the visualization.
e. The Role Distribution calculation should be updated to include all roles present in the system, ensuring the chart accurately reflects the organization’s role distribution.
Related PRS (if any):
No front end PR needed.
Main changes explained:
The Role Distribution chart on the Dashboard currently displays only two roles, even though multiple roles exist in the system (Volunteer, Manager, Administrator, Core Team, Owner, Mentor), leading to inaccurate and misleading reporting.
Root Cause: The getRoleDistributionStats function was filtering users by createdDate when date parameters were provided, which meant only users created within the selected date range were counted for role distribution. This caused several existing roles to be excluded from the visualization if no users with those roles were created in the selected time period.
Changes Made:
Note: The function still accepts date parameters for backward compatibility, but they are no longer used for filtering. Role Distribution now represents the current snapshot of all active users' roles, not a date-filtered subset.
How to test:
npm installandnpm run devto run this PR locallyScreenshots or videos of changes:
Before:


After: