Skip to content

Commit

Permalink
Manual addition of slots in the reserve is now prevented
Browse files Browse the repository at this point in the history
  • Loading branch information
Alf-Melmac committed May 16, 2021
1 parent cdbb8b6 commit a15b414
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/de/webalf/slotbot/service/EventService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import de.webalf.slotbot.exception.ResourceNotFoundException;
import de.webalf.slotbot.model.Event;
import de.webalf.slotbot.model.Slot;
import de.webalf.slotbot.model.Squad;
import de.webalf.slotbot.model.User;
import de.webalf.slotbot.model.dtos.AbstractEventDto;
import de.webalf.slotbot.model.dtos.EventDto;
Expand Down Expand Up @@ -291,7 +292,11 @@ public Event renameSquad(long channel, int squadPosition, String squadName) {
*/
public Event addSlot(long channel, int squadPosition, SlotDto slotDto) {
final Event event = findByChannel(channel);
event.findSquadByPosition(squadPosition).addSlot(slotService.newSlot(slotDto));
final Squad squad = event.findSquadByPosition(squadPosition);
if (squad.isReserve()) {
throw BusinessRuntimeException.builder().title("Der Reserve kann manuell kein Slot hinzugefügt werden.").build();
}
squad.addSlot(slotService.newSlot(slotDto));
return event;
}

Expand Down

0 comments on commit a15b414

Please sign in to comment.