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

fixed reset so that it resets user balance to 10000 and clears user p… #145

Merged
merged 1 commit into from
Nov 27, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/entities/CommonUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,9 @@ public Double getBalance() {
return balance;
}

@Override
public void clearPortfolio() {
this.portfolio.clear();
}

}
1 change: 1 addition & 0 deletions src/main/java/entities/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ public interface User {
void setBalance(Double amount);
void addBalance(Double addition);
Double getBalance();
void clearPortfolio();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void execute() {
Double curBalance = user.getBalance();
Double amountToAdd = 10000.0;
user.setBalance(amountToAdd);
user.clearPortfolio();

// honestly, maybe consider adding a TopupTransaction
HashMap<String, TransactionHistory> userHistory = user.getHistory();
Expand Down