feat: add pie chart visualization for top 5 crowdsourced slurs #785
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.
Overview
This PR adds a pie chart visualization to the dashboard that displays the top 5 most frequently reported crowdsourced slurs.
What’s Included
Seed Script for Testing
Added dummy data using
UserContribution.create_crowdsourced_slur_seed/1
inpriv/repo/seeds.exs
to test the chart effectively.Top 5 Slurs Function
Implemented
get_top_5_slurs/0
in theUserContribution
module. It:%{label, count}
formatDashboard Integration
get_top_5_slurs/0
fromDashboardController
@pie_data
Frontend Integration
@pie_data
in thedashboard.html.heex
template usingJason.encode!
DOMContentLoaded
Related Issue
Fixes #777
Sreenshot :-
