Skip to content
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

[Feature 7] Design and Implement Bill Splitter. #11

Closed
2 tasks done
ScottCTD opened this issue Oct 22, 2022 · 3 comments · Fixed by #45 or #82
Closed
2 tasks done

[Feature 7] Design and Implement Bill Splitter. #11

ScottCTD opened this issue Oct 22, 2022 · 3 comments · Fixed by #45 or #82
Assignees
Labels
enhancement New feature or request

Comments

@ScottCTD
Copy link
Collaborator

ScottCTD commented Oct 22, 2022

Initiations

  • In our daily life, we may buy things for multiple individuals to use.
  • This raises the question that those related individuals need to pay back some value.
  • We define the action of paying back as split the bill.

Design

  • We can treat the data for splitting the bill as a sub-bill of the main bill.
  • We define that sub-bill as a splitter bill.
  • Each entry would have an attribute that refers to the splitter bill.
  • Splitter bills would have different columns than normal bills. They should contain information about payees and whether the payee has paid the money back.
  • In displaying, after we double-clicked the splitter attribute of an entry, the splitter bill will replace the current bill (main bill).
  • We would have a "Back" button to return to the main bill.

Implementation Details

Database Specifications

Table Name: bill_{bill_id}

Table Specifications:

Column Name Data Type Notes
entry_id INT
date TIMESTAMP
value DECIMAL(16, 2) We expect value to have 16 integer places and 2 decimal places. value here is the amount of money that the payee needs to pay.
currency CHAR(3) As defined in ISO 4217, currency codes all have a length of 3
description TEXT
from TEXT
to TEXT
location TEXT
payee TEXT We may want to change the datatype here. We may not need such a big type here.
paid_back BOOLEAN This represents whether the payee had paid the money back.

Related Use Case and Details

  • Since we want to replace the entries directly, we may want to call BillUpdateUseCase.
  • We will set the currentBill in the User class as this bill id.
  • Every time we clicked the "Back" button, we just change the currentBill to the bill id of the main bill of this user, and then call BillUpdateUseCase.
  • Columns inherited from AbstractEntry should have the same values as the parent entry. Inherited columns: date, currency, from, to, location

TODOs

  • Extend the UpdateBillUseCase to this functionality.

Use Case Update: Insert Entry Use Case

If you are willing to participate in the development of this feature, please feel free to assign yourself as an assignee.

@ScottCTD ScottCTD added the enhancement New feature or request label Oct 22, 2022
@ScottCTD ScottCTD self-assigned this Oct 22, 2022
@Yuhan-Ut Yuhan-Ut self-assigned this Oct 24, 2022
@Yunshan-522 Yunshan-522 self-assigned this Oct 24, 2022
@eevadai eevadai self-assigned this Oct 24, 2022
@Ellen141319 Ellen141319 self-assigned this Oct 24, 2022
@ScottCTD
Copy link
Collaborator Author

ScottCTD commented Nov 6, 2022

TODO: #15 (review)

@xgao28
Copy link
Contributor

xgao28 commented Nov 17, 2022

I'm not sure if I understand how the bill splitter works. From my current thought, it works as one of the following examples:

(1) A, B, C, and D had dinner together and A paid the bill altogether at first, being recorded as an entry in A's bill. Then, A, as a user, decided to split the bill, creating 3 split entries for B, C, and D respectively, and A's bill shows the information on these entries including the amount of money they should pay to A as well as whether they paid back.

(2) A, B, C, and D had dinner together and A paid the bill altogether at first, being recorded as an entry in A's bill. Then, A, as a user, decided to split the bill, creating 3 split entries for B, C, and D respectively in a splitter bill from A, and the splitter bill shows the information on these entries including the amount of money they should pay to A as well as whether they paid back.

If neither (QAQ), is there any example that helps me with this?

@ScottCTD
Copy link
Collaborator Author

I'm not sure if I understand how the bill splitter works. From my current thought, it works as one of the following examples:

(1) A, B, C, and D had dinner together and A paid the bill altogether at first, being recorded as an entry in A's bill. Then, A, as a user, decided to split the bill, creating 3 split entries for B, C, and D respectively, and A's bill shows the information on these entries including the amount of money they should pay to A as well as whether they paid back.

(2) A, B, C, and D had dinner together and A paid the bill altogether at first, being recorded as an entry in A's bill. Then, A, as a user, decided to split the bill, creating 3 split entries for B, C, and D respectively in a splitter bill from A, and the splitter bill shows the information on these entries including the amount of money they should pay to A as well as whether they paid back.

If neither (QAQ), is there any example that helps me with this?

For example, if you paid the bill and there are three people who need to pay some money back.

You opened our software and first created a new entry in your main bill. The value should be the total amount of money you spent.

Then, you double-clicked the splitter attribute of the entry you just created. A new splitter bill would be created.

In the new splitter bill, you add 3 entries, each specifying which people should pay how much value back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment