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();
|
Competition competition = (Competition) competitionComboBox.getSelectedItem();
|
||||||
Set<Date> dates = competition.getProjections().stream().map(p -> p.getStartDate()).collect(Collectors.toSet());
|
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);
|
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);
|
localDates = dates.stream().map(Date::toLocalDate).toArray(LocalDate[]::new);
|
||||||
|
|
||||||
for (LocalDate date : localDates)
|
for (LocalDate date : localDates)
|
||||||
|
@ -125,10 +125,10 @@ public class ProjectionHandler extends JDialog {
|
||||||
ArrayList<Slot> slots;
|
ArrayList<Slot> slots;
|
||||||
Competition competition = (Competition) competitionComboBox.getSelectedItem();
|
Competition competition = (Competition) competitionComboBox.getSelectedItem();
|
||||||
Date date = Date.valueOf((LocalDate) dayComboBox.getSelectedItem());
|
Date date = Date.valueOf((LocalDate) dayComboBox.getSelectedItem());
|
||||||
if (projectionType == ProjectionType.ADD)
|
if (projectionType == ProjectionType.REMOVE)
|
||||||
slots = Slot.getAvailable(competition, date);
|
slots = Slot.getAll(competition, date);
|
||||||
else
|
else
|
||||||
slots = Slot.getAll(competition, date);
|
slots = Slot.getAvailable(competition, date);
|
||||||
if (slots != null)
|
if (slots != null)
|
||||||
for (Slot s : slots)
|
for (Slot s : slots)
|
||||||
slotComboBox.addItem(s);
|
slotComboBox.addItem(s);
|
||||||
|
@ -138,18 +138,14 @@ public class ProjectionHandler extends JDialog {
|
||||||
private void updateRooms() {
|
private void updateRooms() {
|
||||||
roomComboBox.removeAllItems();
|
roomComboBox.removeAllItems();
|
||||||
if (dayComboBox.getSelectedItem() != null) {
|
if (dayComboBox.getSelectedItem() != null) {
|
||||||
ArrayList<Room> rooms = null;
|
ArrayList<Room> rooms;
|
||||||
Movie movie = (Movie) filmComboBox.getSelectedItem();
|
Movie movie = (Movie) filmComboBox.getSelectedItem();
|
||||||
Slot slot = (Slot) slotComboBox.getSelectedItem();
|
Slot slot = (Slot) slotComboBox.getSelectedItem();
|
||||||
Date date = Date.valueOf((LocalDate) dayComboBox.getSelectedItem());
|
Date date = Date.valueOf((LocalDate) dayComboBox.getSelectedItem());
|
||||||
switch (projectionType) {
|
if (projectionType == ProjectionType.REMOVE)
|
||||||
case ADD:
|
rooms = Room.getAll(movie, slot, date);
|
||||||
case EDIT:
|
else
|
||||||
rooms = Room.getAvailable(movie, slot, date);
|
rooms = Room.getAvailable(movie, slot, date);
|
||||||
break;
|
|
||||||
case REMOVE:
|
|
||||||
rooms = Room.getAll(movie, slot, date);
|
|
||||||
}
|
|
||||||
if (rooms != null)
|
if (rooms != null)
|
||||||
for (Room r : rooms)
|
for (Room r : rooms)
|
||||||
roomComboBox.addItem(r);
|
roomComboBox.addItem(r);
|
||||||
|
|
Reference in a new issue