From d328eb5e850ebf9c4832427fd72a7a0d3a383d7e Mon Sep 17 00:00:00 2001 From: Mathis Kral Date: Tue, 14 Nov 2023 20:43:15 +0100 Subject: [PATCH] Add improved checkout --- src/main/java/catering/order/OrderController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/catering/order/OrderController.java b/src/main/java/catering/order/OrderController.java index 08c4c48..ea54433 100644 --- a/src/main/java/catering/order/OrderController.java +++ b/src/main/java/catering/order/OrderController.java @@ -69,13 +69,15 @@ public class OrderController { @PostMapping("/event/checkout") public String checkout(Model model) { + LocalDateTime min = LocalDateTime.of(2023, (int) (Math.random() * 11 + 1.0), (int) (Math.random() * 27 + 1.0), (int) (Math.random() * 23 + 1.0), 0, 0); + CustomOrder myOrder = new CustomOrder( cart.getOrderType(), - LocalDateTime.MIN, - LocalDateTime.MAX, + min, + min.plusDays((int) (Math.random() * 5)).plusHours((int) (Math.random() * 10)), cart.getProucts(), false, - Double.MAX_VALUE + Math.round(Math.random() * 10000) ); orderRepository.addOrder(myOrder);