diff --git a/.github/workflows/deploy-development-docker-image.yml b/.github/workflows/deploy-development-docker-image.yml index 04577cb..5b8f195 100644 --- a/.github/workflows/deploy-development-docker-image.yml +++ b/.github/workflows/deploy-development-docker-image.yml @@ -12,7 +12,7 @@ env: jobs: build-and-push-image: - runs-on: self-hosted + runs-on: ubuntu-latest permissions: contents: read packages: write diff --git a/.github/workflows/deploy-docker-image-on-release.yml b/.github/workflows/deploy-docker-image-on-release.yml index 8bf0302..417f940 100644 --- a/.github/workflows/deploy-docker-image-on-release.yml +++ b/.github/workflows/deploy-docker-image-on-release.yml @@ -17,7 +17,7 @@ env: jobs: build-and-push-image: - runs-on: self-hosted + runs-on: ubuntu-latest permissions: contents: read packages: write diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0dd3bda..15a03e9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: jobs: build: name: Test - runs-on: self-hosted + runs-on: ubuntu-latest services: diff --git a/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultDTO.java b/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultDTO.java index 15cf6ea..f912258 100644 --- a/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultDTO.java +++ b/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultDTO.java @@ -23,7 +23,14 @@ public class GameResultDTO { */ List submittedSolutions; + /** + * The score achieved in the game. + */ long score; + + /** + * The reward-coins that the player achieved in the current round. + */ int rewards; } diff --git a/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultService.java b/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultService.java index bcc2794..a38e92d 100644 --- a/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultService.java +++ b/src/main/java/de/unistuttgart/bugfinder/gameresult/GameResultService.java @@ -213,14 +213,19 @@ private long calculateScoreFromCodeScores(final Map 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); diff --git a/src/main/java/de/unistuttgart/bugfinder/gameresult/OverworldResultDTO.java b/src/main/java/de/unistuttgart/bugfinder/gameresult/OverworldResultDTO.java index dc6a0aa..d982c36 100644 --- a/src/main/java/de/unistuttgart/bugfinder/gameresult/OverworldResultDTO.java +++ b/src/main/java/de/unistuttgart/bugfinder/gameresult/OverworldResultDTO.java @@ -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; }