refactor: subtract betamount on blank status
All checks were successful
CI / Get Changed Files (pull_request) Successful in 6s
CI / Docker frontend validation (pull_request) Successful in 9s
CI / eslint (pull_request) Has been skipped
CI / oxlint (pull_request) Has been skipped
CI / prettier (pull_request) Has been skipped
CI / test-build (pull_request) Has been skipped
CI / Docker backend validation (pull_request) Successful in 49s
CI / Checkstyle Main (pull_request) Successful in 51s
All checks were successful
CI / Get Changed Files (pull_request) Successful in 6s
CI / Docker frontend validation (pull_request) Successful in 9s
CI / eslint (pull_request) Has been skipped
CI / oxlint (pull_request) Has been skipped
CI / prettier (pull_request) Has been skipped
CI / test-build (pull_request) Has been skipped
CI / Docker backend validation (pull_request) Successful in 49s
CI / Checkstyle Main (pull_request) Successful in 51s
This commit is contained in:
parent
1a42057962
commit
6e101a0cab
1 changed files with 9 additions and 18 deletions
|
@ -52,30 +52,21 @@ public class SlotService {
|
||||||
|
|
||||||
private SpinResult processResult(BigDecimal betAmount, UserEntity user, Status status, Symbol winSymbol) {
|
private SpinResult processResult(BigDecimal betAmount, UserEntity user, Status status, Symbol winSymbol) {
|
||||||
SpinResult spinResult = new SpinResult();
|
SpinResult spinResult = new SpinResult();
|
||||||
|
spinResult.setStatus(status.name().toLowerCase());
|
||||||
|
|
||||||
switch (status) {
|
if (status == Status.WIN) {
|
||||||
case WIN:
|
BigDecimal winAmount = betAmount.multiply(winSymbol.getPayoutMultiplier());
|
||||||
BigDecimal winAmount = betAmount.multiply(winSymbol.getPayoutMultiplier());
|
this.balanceService.addFunds(user, winAmount);
|
||||||
this.balanceService.addFunds(user, winAmount);
|
spinResult.setAmount(winAmount);
|
||||||
spinResult.setAmount(winAmount);
|
} else {
|
||||||
spinResult.setStatus(Status.WIN.name().toLowerCase());
|
this.balanceService.subtractFunds(user, betAmount);
|
||||||
break;
|
spinResult.setAmount(betAmount);
|
||||||
|
|
||||||
case BLANK:
|
|
||||||
spinResult.setAmount(BigDecimal.ZERO);
|
|
||||||
spinResult.setStatus(Status.BLANK.name().toLowerCase());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LOSE:
|
|
||||||
this.balanceService.subtractFunds(user, betAmount);
|
|
||||||
spinResult.setAmount(betAmount);
|
|
||||||
spinResult.setStatus(Status.LOSE.name().toLowerCase());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return spinResult;
|
return spinResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void buildResultMatrix(SpinResult spinResult, int index1, int index2, int index3) {
|
private void buildResultMatrix(SpinResult spinResult, int index1, int index2, int index3) {
|
||||||
List<List<Symbol>> resultMatrix = new ArrayList<>(3);
|
List<List<Symbol>> resultMatrix = new ArrayList<>(3);
|
||||||
|
|
||||||
|
|
Reference in a new issue