mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-19 21:04:36 +02:00
Fix calender() order in wrong calender day/cell
This commit is contained in:
parent
c7c8a0126a
commit
9b71926c58
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue