-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create DebtFilter module for Bet #56
base: master
Are you sure you want to change the base?
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.
I think there's room to simplify the DebtFilter
module a lot. Instead of pointing out lots of little changes, I'd encourage you to try refactoring it.
reverse_negatives(merge_debts(reverse_duplicates(debts))) | ||
end | ||
|
||
def unique_participants(debts) |
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.
This whole method can be written in a much simpler way.
Hint: Think about the fact that you're creating an array called uniques
and ensuring uniqueness of the things you're adding to it.
@@ -0,0 +1,55 @@ | |||
module DebtFilter |
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.
This module has one public method, but 5 private methods that handle combining debts between the same people. These methods also iterate over the same array many times, maybe see if you can simplify this.
This branch is out of date with master. Please update. |
-DebtFilter addresses the problem, where some of the created Debts for a particular Bet would cross-reference each other (PersonA -$50-> PersonB && PersonB -$20-> PersonA) or accumulate as separate entries (PerosnA -$50-> PersonB && PersonA -$20-> PersonB) by filtering them before saving. -Added DebtFilter to Bet model. Debts are now filtered before getting saved.
371eb98
to
ec4c39c
Compare
Pivotal: https://www.pivotaltracker.com/story/show/141907091
-DebtFilter addresses the problem, where some of the created Debts for a
particular Bet would cross-reference each other (PersonA -$50-> PersonB
&& PersonB -$20-> PersonA) or accumulate as separate entries (PerosnA
-$50-> PersonB && PersonA -$20-> PersonB) by filtering them before
saving.
-Added DebtFilter to Bet model. Debts are now filtered before getting
saved.