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

took out default balance #231

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/entity/CommonUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public CommonUser(
* portfolio and a balance of 10000
*/
public CommonUser() {
this.balance = 10000.0;
this.balance = User.DEFAULT_BALANCE;
this.portfolio = new HashMap<>();
this.history = new HashMap<>();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.HashMap;

public interface User {
Double DEFAULT_BALANCE = 10000.0;
HashMap<String, TransactionHistory> getHistory();
void addToPortfolio(String ticker, Double amount);
void removeFromPortfolio(String ticker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import use_case.BaseStockInteractor;

import java.time.LocalDateTime;
import java.util.HashMap;

public class ResetBalanceInteractor extends BaseStockInteractor implements ResetBalanceInputBoundary {
final ResetBalanceDataAccessInterface userDataAccessObject;
Expand Down Expand Up @@ -58,7 +57,7 @@ public void execute(ResetBalanceInputData resetBalanceInputData) {
Boolean resetPressed = resetBalanceInputData.getResetPressed();
User user = userDataAccessObject.get();
Double curBalance = user.getBalance();
Double amountToAdd = 10000.0;
Double amountToAdd = User.DEFAULT_BALANCE;

user.setBalance(amountToAdd);
user.clearPortfolio();
Expand Down
Loading