Skip to content
Snippets Groups Projects
Commit cc72c9cb authored by Stefan Hugtenburg's avatar Stefan Hugtenburg
Browse files

Summer break support

parent bce3d1a0
Branches
Tags
2 merge requests!16Deploy for summer,!15Summer break support
Pipeline #1149697 passed
......@@ -46,6 +46,8 @@ public interface PuzzleRepository extends JpaRepository<Puzzle, Long> {
Puzzle findByDayUsed(LocalDate date);
Puzzle findFirstByDayUsedBeforeOrderByDayUsedDesc(LocalDate date);
List<Puzzle> findByDayUsedIsNotNullAndDayUsedIsBefore(LocalDate date);
List<Puzzle> findByDayUsedIsBeforeAndCreator(LocalDate date, PupplePerson creator);
......
......
......@@ -37,6 +37,9 @@ public class PuzzleService {
public Puzzle getTodaysPuzzle() {
LocalDate today = LocalDate.now();
Puzzle result = puzzleRepository.findByDayUsed(today);
if (result == null) {
result = puzzleRepository.findFirstByDayUsedBeforeOrderByDayUsedDesc(today);
}
return result;
}
......
......
......@@ -26,7 +26,7 @@
<a th:href="@{/}" class="header__title"><h1>Pupple</h1></a>
<nav aria-label="primary" class="header__links flex">
<a th:href="@{/puzzle/today}">Today's puzzle</a>
<a th:href="@{/puzzle/today}">Most recent puzzle</a>
<a th:href="@{/puzzle/}">All puzzles</a>
<a th:href="@{/puzzle/new}" th:if="${@authorisationService.canCreatePuzzle()}">
New puzzle
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment