-
Notifications
You must be signed in to change notification settings - Fork 19
[BUG, GoodCollective] Order logic off on donors page #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG, GoodCollective] Order logic off on donors page #289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @alisonhawk - I've reviewed your changes - here's some feedback:
Overall Comments:
- It looks like you're calculating
totalDonationsin a few different places; can you consolidate this logic into a single hook or utility function?
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
| Category | Issue | Fix Detected |
|---|---|---|
| Incorrect Sort Comparison Logic ▹ view | ✅ | |
| Inefficient BigInt Conversion ▹ view | ✅ | |
| Potentially incorrect flow rate calculation due to undefined parameter ▹ view |
Files scanned
| File Path | Reviewed |
|---|---|
| packages/app/src/hooks/donors/useDonorWithTotal.ts | ✅ |
| packages/app/src/hooks/donors/useDonorsWithTotal.ts | ✅ |
| packages/app/src/components/DonorsList/DonorsList.tsx | ✅ |
| packages/app/src/pages/ViewDonorsPage.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-reviewon this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-reviewcommand in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-descriptioncommand in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolvecommand in any comment on your PR.- Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Feedback and Support
| const donorsWithTotal = donors.map(useDonorWithTotal); | ||
|
|
||
| return useMemo( | ||
| () => donorsWithTotal.sort((a, b) => (b.totalDonations > a.totalDonations ? 1 : -1)), |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
sirpy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use lodash sort for your sorting needs
|
@sirpy Pushed requested changes |
|
@sirpy can you merge it? |
Description
As mentioned in the issue #258
The issue is caused because donors are sorted by their past contribution not taking into account their current active stream.
In the display of each donor the amount displayed is past contribution + time*flowrate
Fixed:
About #258
How Has This Been Tested?
live using the dev server
Please describe the tests that you ran to verify your changes.
Checklist:
Description by Korbit AI
What change is being made?
Refactor the donor sorting logic on the DonorsList component by utilizing new hooks
useDonorWithTotalanduseDonorsWithTotalto accurately calculate and sort donors based on total donations.Why are these changes being made?
The previous implementation incorrectly sorted donors due to the inappropriate usage of the Decimal library. This refactoring introduces a more reliable hook-based approach to ensure accurate sorting, aligning donor contributions with their total donations, and ensuring consistency across donor listings.