Fix Tergel mess
This commit is contained in:
parent
45c7e62bd8
commit
71412f825d
1 changed files with 9 additions and 13 deletions
|
@ -111,7 +111,7 @@ public class ProjectionHandler extends JDialog {
|
|||
Competition competition = (Competition) competitionComboBox.getSelectedItem();
|
||||
Set<Date> dates = competition.getProjections().stream().map(p -> p.getStartDate()).collect(Collectors.toSet());
|
||||
LocalDate[] localDates = LocalDate.of(2021, 5, 11).datesUntil(LocalDate.of(2021, 5, 22)).toArray(LocalDate[]::new);
|
||||
if (competition.getDays() != 0 && dates.size() >= competition.getDays())
|
||||
if (competition.getDays() != 0 && dates.size() >= competition.getDays() && !(projectionType == ProjectionType.EDIT && projection.getCompetition().getName().equals(competition.getName())))
|
||||
localDates = dates.stream().map(Date::toLocalDate).toArray(LocalDate[]::new);
|
||||
|
||||
for (LocalDate date : localDates)
|
||||
|
@ -125,10 +125,10 @@ public class ProjectionHandler extends JDialog {
|
|||
ArrayList<Slot> slots;
|
||||
Competition competition = (Competition) competitionComboBox.getSelectedItem();
|
||||
Date date = Date.valueOf((LocalDate) dayComboBox.getSelectedItem());
|
||||
if (projectionType == ProjectionType.ADD)
|
||||
slots = Slot.getAvailable(competition, date);
|
||||
else
|
||||
if (projectionType == ProjectionType.REMOVE)
|
||||
slots = Slot.getAll(competition, date);
|
||||
else
|
||||
slots = Slot.getAvailable(competition, date);
|
||||
if (slots != null)
|
||||
for (Slot s : slots)
|
||||
slotComboBox.addItem(s);
|
||||
|
@ -138,18 +138,14 @@ public class ProjectionHandler extends JDialog {
|
|||
private void updateRooms() {
|
||||
roomComboBox.removeAllItems();
|
||||
if (dayComboBox.getSelectedItem() != null) {
|
||||
ArrayList<Room> rooms = null;
|
||||
ArrayList<Room> rooms;
|
||||
Movie movie = (Movie) filmComboBox.getSelectedItem();
|
||||
Slot slot = (Slot) slotComboBox.getSelectedItem();
|
||||
Date date = Date.valueOf((LocalDate) dayComboBox.getSelectedItem());
|
||||
switch (projectionType) {
|
||||
case ADD:
|
||||
case EDIT:
|
||||
rooms = Room.getAvailable(movie, slot, date);
|
||||
break;
|
||||
case REMOVE:
|
||||
if (projectionType == ProjectionType.REMOVE)
|
||||
rooms = Room.getAll(movie, slot, date);
|
||||
}
|
||||
else
|
||||
rooms = Room.getAvailable(movie, slot, date);
|
||||
if (rooms != null)
|
||||
for (Room r : rooms)
|
||||
roomComboBox.addItem(r);
|
||||
|
|
Reference in a new issue