Added a datelock to end votes automatically

This commit is contained in:
2020-12-27 23:23:41 +01:00
parent 0597edf116
commit 2a8ba84bec
3 changed files with 695 additions and 1 deletions

View File

@@ -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) {

View 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>