Skip to content

Commit

Permalink
fix(Player): Infitnite domain division error
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelsa committed May 14, 2026
1 parent 9392e55 commit ba24b8d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/edu/ntnu/idi/idatt/model/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import edu.ntnu.idi.idatt.model.transaction.TransactionArchive;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Player {

Expand Down Expand Up @@ -76,7 +77,7 @@ public BigDecimal getNetWorth() {
*/
public String getStatus() {
int tradingWeeks = transactionArchive.countDistinctWeeks();
BigDecimal netWorth = this.getNetWorth().divide(this.startingMoney);
BigDecimal netWorth = this.getNetWorth().divide(this.startingMoney, 2, RoundingMode.HALF_UP);

if (tradingWeeks >= 20 && netWorth.compareTo(new BigDecimal("2")) >= 0) {
return "Speculator";
Expand Down

0 comments on commit ba24b8d

Please sign in to comment.