limit ist maximal 50
parent
13eafaf06a
commit
98ebcad2eb
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue