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) {
|
||||
SpinResult spinResult = new SpinResult();
|
||||
spinResult.setStatus(status.name().toLowerCase());
|
||||
|
||||
switch (status) {
|
||||
case WIN:
|
||||
BigDecimal winAmount = betAmount.multiply(winSymbol.getPayoutMultiplier());
|
||||
this.balanceService.addFunds(user, winAmount);
|
||||
spinResult.setAmount(winAmount);
|
||||
spinResult.setStatus(Status.WIN.name().toLowerCase());
|
||||
break;
|
||||
|
||||
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;
|
||||
if (status == Status.WIN) {
|
||||
BigDecimal winAmount = betAmount.multiply(winSymbol.getPayoutMultiplier());
|
||||
this.balanceService.addFunds(user, winAmount);
|
||||
spinResult.setAmount(winAmount);
|
||||
} else {
|
||||
this.balanceService.subtractFunds(user, betAmount);
|
||||
spinResult.setAmount(betAmount);
|
||||
}
|
||||
|
||||
return spinResult;
|
||||
}
|
||||
|
||||
|
||||
private void buildResultMatrix(SpinResult spinResult, int index1, int index2, int index3) {
|
||||
List<List<Symbol>> resultMatrix = new ArrayList<>(3);
|
||||
|
||||
|
|
Reference in a new issue