diff --git a/src/dev/peerat/backend/model/Chapter.java b/src/dev/peerat/backend/model/Chapter.java index dc35c49..312fde4 100644 --- a/src/dev/peerat/backend/model/Chapter.java +++ b/src/dev/peerat/backend/model/Chapter.java @@ -35,11 +35,10 @@ public class Chapter { this.puzzles = puzzles; } - public boolean isInCurrentTime(){ + public boolean hasStarted(){ LocalDateTime now = LocalDateTime.now(); boolean show = true; if(startDate != null) show &= now.isAfter(startDate.toLocalDateTime()); - if(endDate != null) show &= now.isBefore(endDate.toLocalDateTime()); return show; } diff --git a/src/dev/peerat/backend/model/Puzzle.java b/src/dev/peerat/backend/model/Puzzle.java index b783493..453a18f 100644 --- a/src/dev/peerat/backend/model/Puzzle.java +++ b/src/dev/peerat/backend/model/Puzzle.java @@ -86,7 +86,7 @@ public class Puzzle { return this.depend; } - public boolean isInCurrentTime(){ + public boolean hasStarted(){ LocalDateTime now = LocalDateTime.now(); boolean show = true; if(startDate != null) show &= now.isAfter(startDate.toLocalDateTime()); diff --git a/src/dev/peerat/backend/routes/ChapterElement.java b/src/dev/peerat/backend/routes/ChapterElement.java index 65327bc..00fc875 100644 --- a/src/dev/peerat/backend/routes/ChapterElement.java +++ b/src/dev/peerat/backend/routes/ChapterElement.java @@ -33,7 +33,7 @@ public class ChapterElement implements Response { JsonMap chapterJSON = new JsonMap(); chapterJSON.set("id", chapter.getId()); chapterJSON.set("name", chapter.getName()); - boolean show = chapter.isInCurrentTime(); + boolean show = chapter.hasStarted(); chapterJSON.set("show", show); PeerAtUser user = context.getUser(); if(show){ @@ -46,7 +46,7 @@ public class ChapterElement implements Response { if (puzzle.getTags() != null) puzzleJSON.set("tags", puzzle.getJsonTags()); int score = this.databaseRepo.getScore(user.getId(), puzzle.getId()); if(score >= 0) puzzleJSON.set("score", score); - puzzleJSON.set("show", puzzle.isInCurrentTime()); + puzzleJSON.set("show", puzzle.hasStarted()); puzzles.add(puzzleJSON); } chapterJSON.set("puzzles", puzzles); diff --git a/src/dev/peerat/backend/routes/ChapterList.java b/src/dev/peerat/backend/routes/ChapterList.java index ac30c0d..e9dfd32 100644 --- a/src/dev/peerat/backend/routes/ChapterList.java +++ b/src/dev/peerat/backend/routes/ChapterList.java @@ -34,7 +34,7 @@ public class ChapterList implements Response { JsonMap chapterJSON = new JsonMap(); chapterJSON.set("id", chapter.getId()); chapterJSON.set("name", chapter.getName()); - chapterJSON.set("show", chapter.isInCurrentTime()); + chapterJSON.set("show", chapter.hasStarted()); chaptersJSON.add(chapterJSON); } context.response(200);