-
Notifications
You must be signed in to change notification settings - Fork 4
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
show declined kids transactions (KIDS-1235) #1133
show declined kids transactions (KIDS-1235) #1133
Conversation
WalkthroughThe changes in this pull request modify the Changes
Assessment against linked issues
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
lib/features/family/features/history/history_repository/history_repository.dart (1)
38-43
: Approved changes with suggestions for improvementThe changes successfully address the PR objective of showing declined donations in the child's "My Givts" section. The new filtering logic correctly includes rejected or cancelled donations while excluding other types of transactions with these statuses.
However, I have a few suggestions to improve the code:
- Refactor for readability:
- if ((donationMap['status'] == 'Rejected' || - donationMap['status'] == 'Cancelled') && - donationMap['donationType'] != HistoryTypes.donation.value) { + final isRejectedOrCancelled = donationMap['status'] == 'Rejected' || donationMap['status'] == 'Cancelled'; + final isNotDonation = donationMap['donationType'] != HistoryTypes.donation.value; + if (isRejectedOrCancelled && isNotDonation) { continue; }
- Add null checks to prevent potential null pointer exceptions:
+ final status = donationMap['status'] as String?; + final donationType = donationMap['donationType'] as String?; + final isRejectedOrCancelled = status == 'Rejected' || status == 'Cancelled'; + final isNotDonation = donationType != null && donationType != HistoryTypes.donation.value; if (isRejectedOrCancelled && isNotDonation) { continue; }
- Add a comment explaining the logic:
+ // Include rejected or cancelled donations, but exclude other transaction types with these statuses final status = donationMap['status'] as String?; final donationType = donationMap['donationType'] as String?; final isRejectedOrCancelled = status == 'Rejected' || status == 'Cancelled'; final isNotDonation = donationType != null && donationType != HistoryTypes.donation.value; if (isRejectedOrCancelled && isNotDonation) { continue; }
These changes will improve code readability, robustness, and maintainability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- lib/features/family/features/history/history_repository/history_repository.dart (1 hunks)
Summary by CodeRabbit
New Features
Bug Fixes