Fix calender() order in wrong calender day/cell

This commit is contained in:
Theo Reichert 2023-11-15 00:31:09 +01:00 committed by Simon Bruder
parent d328eb5e85
commit fcacb18111
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
@ -138,10 +139,10 @@ public class OrderController {
for (CustomOrder order : orders_in_next_month) {
int start_index_inclusive = Math.max(order.getStart().toLocalDate().compareTo(startDate),0);
int end_index_exclusive = Math.min(order.getFinish().toLocalDate().compareTo(startDate), 27) + 1;
int start_index_inclusive = Math.max((int) startDate.until(order.getStart().toLocalDate(), ChronoUnit.DAYS),0);
int end_index_exclusive = Math.min((int) startDate.until(order.getFinish().toLocalDate(), ChronoUnit.DAYS), 27) + 1;
for (int i = start_index_inclusive; i < end_index_exclusive; i++) {
weeksOfMonth.get((int) i/7).get(Math.floorMod(i,7)).add(Integer.toString(order.getId()));
weeksOfMonth.get(Math.floorDiv(i,7)).get(Math.floorMod(i,7)).add(Integer.toString(order.getId()));
}
}
// for (List<List<String>> orders_in_next_week : orders_in_next_month) {