limit ist maximal 50

pull/24/head
eric 2025-08-07 15:04:47 +02:00
parent 13eafaf06a
commit 98ebcad2eb
3 changed files with 3 additions and 9 deletions

View File

@ -63,7 +63,8 @@ package eric.Roullette.service;
userApis.put(user, userApi); userApis.put(user, userApi);
} }
public List<String> getRecentTracks(String user, int limit) { public List<String> getRecentTracks(String user) {
int limit = 50;
SpotifyApi userApi = userApis.get(user); SpotifyApi userApi = userApis.get(user);
if (userApi == null) { if (userApi == null) {

View File

@ -80,7 +80,7 @@ public class GameWebSocketHandler {
// Songs von allen Spielern sammeln // Songs von allen Spielern sammeln
List<String> allTracks = new ArrayList<>(); List<String> allTracks = new ArrayList<>();
for (String player : game.players()) { for (String player : game.players()) {
allTracks.addAll(authService.getRecentTracks(player, game.limit())); allTracks.addAll(authService.getRecentTracks(player));
} }
if (allTracks.isEmpty()) { if (allTracks.isEmpty()) {
// TODO: Fehler an Client senden, dass keine Songs da sind // TODO: Fehler an Client senden, dass keine Songs da sind

View File

@ -5,13 +5,6 @@
<title>Spiel erstellen Spotify Roulette</title> <title>Spiel erstellen Spotify Roulette</title>
</head> </head>
<body> <body>
<label for="limit">Wie viele kürzlich gehörte Songs sollen verwendet werden?</label>
<select id="limit">
<option value="10">10</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="500">500</option>
</select>
<h1>Neues Spiel erstellen</h1> <h1>Neues Spiel erstellen</h1>
<button id="createGame">Spiel erstellen</button> <button id="createGame">Spiel erstellen</button>