Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer #38

Merged
merged 18 commits into from
Feb 14, 2024
Merged

Multiplayer #38

merged 18 commits into from
Feb 14, 2024

Conversation

PaulKreft
Copy link
Owner

@PaulKreft PaulKreft commented Feb 14, 2024

Without tests for now

Copy link

Quality Gate Failed Quality Gate failed for 'paulkreft_capstone_frontend'

Failed conditions
1 Security Hotspot
5.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link

Quality Gate Failed Quality Gate failed for 'paulkreft_capstone_backend'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link

@kahlamari kahlamari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice 👍 🥇
Ich glaube, ich habe mal wieder mehr in deinem PR gelernt als ich zurückgeben kann.

}

public Lobby joinLobby(String id, @RequestBody Player player) {
Lobby lobby = lobbyRepo.findById(id).orElseThrow(RuntimeException::new);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier könntest du die getLobbyById Methode des Service nutzen.

public Lobby setWinner(String id, ObjectNode payload) throws JsonProcessingException {
Lobby lobby = lobbyRepo.findById(id).orElseThrow(RuntimeException::new);

Player player = new ObjectMapper().treeToValue(payload.get("player"), Player.class);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wieso so kompliziert?
Kann sich aber vielleicht später noch für mich kläre ;)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye... I see. Du hast wohl den Spieler und die Zeit im Body.

}
}

return lobbyRepo.save(lobby.withWinner(player).withTimeToBeat(time));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich glaube ich fände es leserlicher, wenn du erst den Fall winner == null behandelst. Weniger Einrückungen und weniger Negierung.

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/lobby")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vielleicht "lobbies" statt "lobby". Deine anderen APIs sind auch im Plural.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bin auch pro Vereinheitlichung. Vielleicht benenne ich die anderen dann eher so um, dass sie auch im Singular stehen.

@PaulKreft PaulKreft merged commit 76eb3b3 into main Feb 14, 2024
3 of 5 checks passed
@PaulKreft PaulKreft deleted the multiplayer branch February 14, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants