fixed bugs

This commit is contained in:
Jottyfan
2025-12-14 21:51:29 +01:00
parent 3726b9172c
commit b048b7c7bc
9 changed files with 64 additions and 30 deletions

View File

@@ -8,31 +8,33 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import de.jottyfan.bico.modules.CommonController;
/**
*
*
* @author jotty
*
*
*/
@Controller
public class NextController extends CommonController {
@Autowired
private NextService service;
@GetMapping("/next")
public String getNext(Model model) {
model.addAttribute("list", service.getNext(LocalDate.now()));
public String getNext(@RequestParam(name = "groupname", required = false) String groupname, Model model) {
model.addAttribute("list", service.getNext(LocalDate.now(), groupname));
return "/next";
}
@GetMapping("/next/{date}")
public String getNextForDate(@PathVariable("date") String dateStr, Model model) {
public String getNextForDate(@PathVariable("date") String dateStr,
@RequestParam(name = "groupname", required = false) String groupname, Model model) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate date = LocalDate.parse(dateStr, formatter);
model.addAttribute("list", service.getNext(date));
LocalDate date = LocalDate.parse(dateStr, formatter);
model.addAttribute("list", service.getNext(date, groupname));
return "/next";
}
}