Skip to content

Commit

Permalink
Changed sale transaction to use the transaction factory
Browse files Browse the repository at this point in the history
  • Loading branch information
Solveig Natvig committed May 24, 2026
1 parent bf27a2e commit 1be2e99
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/Model/Exchange.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public Transaction sell(Share originalShare, BigDecimal sellQuantity, Player pla
if (sellQuantity.compareTo(originalShare.getQuantity()) > 0) {
return null;
}

Share shareToSell;

if (sellQuantity.compareTo(originalShare.getQuantity()) < 0) {
Expand Down Expand Up @@ -141,7 +141,8 @@ public Transaction sell(Share originalShare, BigDecimal sellQuantity, Player pla
shareToSell = originalShare;
}

Sale sale = new Sale(shareToSell, this.week);
// Salgstransaksjon via fabrikken
Transaction sale = TransactionFactory.createSale(shareToSell, this.week);

sale.commit(player);
notifyObservers();
Expand Down

0 comments on commit 1be2e99

Please sign in to comment.