Added a datelock to end votes automatically
This commit is contained in:
@@ -19,6 +19,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@@ -85,7 +87,16 @@ public class VotingController {
|
||||
|
||||
@RequestMapping("/")
|
||||
public String WelcomeSite() {
|
||||
return "start.html";
|
||||
LocalDate finishDate = LocalDate.of(2021, Month.JANUARY,8);
|
||||
LocalDate now = LocalDate.now();
|
||||
|
||||
if(now.isAfter(finishDate)){
|
||||
LOGGER.warn("passed");
|
||||
return "errors/votingClosed.html";
|
||||
} else {
|
||||
LOGGER.warn("in Bounds");
|
||||
return "start.html";
|
||||
}
|
||||
}
|
||||
|
||||
public void sendSimpleMessage(String to, String subject, String text) {
|
||||
|
||||
24
src/main/resources/templates/errors/votingClosed.html
Normal file
24
src/main/resources/templates/errors/votingClosed.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de" xmlns:th="https://www.thymeleaf.org/">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<link th:href="@{/styles/allreadyVoted.css}" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body class="center-screen">
|
||||
<div class="centered">
|
||||
<h1>Das Voting wurde beendet!</h1>
|
||||
<h2>Informationen zu Votings sind der Adolfinumwebsite zu entnehmen</h2>
|
||||
<button id="backButton" class="submitButton">Zur Adolfinum Seite</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById("backButton").onclick = function() {
|
||||
location.href = "https://adolfinum.de";
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user