Skip to content

Commit

Permalink
Updated code review (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fa8Bit authored Oct 10, 2024
2 parents 5af0fd5 + a9bf01b commit 4ab5598
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-development-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
build-and-push-image:
runs-on: self-hosted
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docker-image-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:

jobs:
build-and-push-image:
runs-on: self-hosted
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
build:
name: Test
runs-on: self-hosted
runs-on: ubuntu-latest


services:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ public class GameResultDTO {
*/
List<SubmittedSolutionDTO> submittedSolutions;

/**
* The score achieved in the game.
*/
long score;

/**
* The reward-coins that the player achieved in the current round.
*/
int rewards;

}
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,19 @@ private long calculateScoreFromCodeScores(final Map<Code, Long> codeScore) {
.orElse(MAX_SCORE);
}



/**
* This method calculates the rewards for one bugfinder round based on the gained scores in the
* current round
* @param score
* @return gained rewards
* Calculates the rewards for a bugfinder round based on the score achieved in the current round.
*
* Reward logic:
* - First three rounds with a score of 100%: 10 coins per round.
* - After the third round, if the score is 100%: 5 coins per round.
* - If the score is less than 100%, the reward is calculated as: score / 10.
*
* @param score the score achieved in the game (must be >= 0)
* @return the number of rewards as an integer
* @throws IllegalArgumentException if score is less than 0
*/

private int calculateRewards(final long score) {
if (score < 0 || score > MAX_SCORE) {
throw new IllegalArgumentException("Score must be between 0 and " + MAX_SCORE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ public class OverworldResultDTO {

final String game = "BUGFINDER"; //NOSONAR
UUID configurationId;

/**
* The score achieved in the game.
*/
long score;

String userId;

/**
* The reward-coins that the player achieved in the current round.
*/
int rewards;
}

0 comments on commit 4ab5598

Please sign in to comment.