complete implementation of the revenue sharing model #3

Merged
dachary merged 1 commits from dachary/accountant:wip-share into master 2022-08-20 03:06:55 +00:00

See the leading comment for a detailed explanation.

Signed-off-by: Loïc Dachary loic@dachary.org

See the leading comment for a detailed explanation. Signed-off-by: Loïc Dachary <loic@dachary.org>
dachary added 1 commit 2022-08-16 08:19:11 +00:00
dc796278a6
complete implementation of the revenue sharing model
See the leading comment for a detailed explanation.

Signed-off-by: Loïc Dachary <loic@dachary.org>
dachary requested review from Gusted 2022-08-16 08:19:30 +00:00
dachary requested review from realaravinth 2022-08-16 08:19:38 +00:00
Gusted reviewed 2022-08-18 04:35:23 +00:00
@ -3,0 +69,4 @@
members = [["a", 10, 5], ["b", 450, 25], ["c", 0, 0]]
payable, payments = share_income(members)
assert payable == [["a", 10, 5], ["b", 20, 25]]
assert payments == {"a": [("b", 5)]}

Why does a give their whole income to b, who already has an income of 25?

Why does `a` give their whole income to `b`, who already has an income of 25?
Poster
Owner

It's the other way around :-) "a" receives 5 from "b".

It's the other way around :-) "a" receives 5 from "b".

Aha okay, might have missed the comments that specified the structure 😅

Aha okay, might have missed the comments that specified the structure :sweat_smile:
dachary marked this conversation as resolved
dachary reviewed 2022-08-18 12:11:23 +00:00
@ -3,0 +35,4 @@
# For instance in the if the 'members' argument is [['isabelle', 200, 10]], the
# shares will be [['isabelle', 10, 10]] where the 200 expense was reduced to a
# share of 10 because there only is 10 income available.
#
Poster
Owner

The comment explaining the structure is here @gusted.

The comment explaining the structure is here @gusted.

It doesn't mention the result structure which is member: getting paid by and how much

It doesn't mention the result structure which is `member: getting paid by and how much`
Poster
Owner

Right: I meant what is below these lines... but it only shows the above. I'll try again.

Right: I meant what is below these lines... but it only shows the above. I'll try again.
dachary marked this conversation as resolved
dachary reviewed 2022-08-18 20:58:15 +00:00
@ -3,0 +50,4 @@
# 'marie': [('isabelle', 200), ('john', 50)],
# 'lucie': [('john', 10)],
# }
#
Poster
Owner

The comment explaining the structure is here @gusted.

# The 'payments' maps member IDs to the amount other peer members must be invoiced:
#
#  {
#    ID: [(ID, integer), (ID, integer), ...],
#    ...
#  }
#
# For instance in the following marie will invoice isable for 200
# and john for 50 while lucie will invoice john for 10:
#
#  {
#    'marie': [('isabelle', 200), ('john', 50)],
#    'lucie': [('john', 10)],
#  }
#
The comment explaining the structure is here @gusted. ``` # The 'payments' maps member IDs to the amount other peer members must be invoiced: # # { # ID: [(ID, integer), (ID, integer), ...], # ... # } # # For instance in the following marie will invoice isable for 200 # and john for 50 while lucie will invoice john for 10: # # { # 'marie': [('isabelle', 200), ('john', 50)], # 'lucie': [('john', 10)], # } # ```
Gusted marked this conversation as resolved
Gusted approved these changes 2022-08-20 01:20:52 +00:00
Gusted left a comment
Owner

Looks according to spec!

Looks according to spec!
dachary merged commit e817380e42 into master 2022-08-20 03:06:55 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Hostea/accountant#3
There is no content yet.