Added second voting

This commit is contained in:
2021-01-09 02:35:55 +01:00
parent e9e9cfca97
commit 436142f546
3 changed files with 31 additions and 8 deletions

View File

@@ -76,7 +76,7 @@ public class VotingController {
@RequestMapping("/") @RequestMapping("/")
public String WelcomeSite() { public String WelcomeSite() {
LocalDate finishDate = LocalDate.of(2021, Month.JANUARY,8); LocalDate finishDate = LocalDate.of(2021, Month.JANUARY,17);
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
if(now.isAfter(finishDate)){ if(now.isAfter(finishDate)){

View File

@@ -8,15 +8,38 @@
</head> </head>
<body class="center-screen"> <body class="center-screen">
<div class="centered"> <div class="centered">
<h1>Du hast schon abgestimmt!</h1> <h1>Du hast schon abgestimmt!</h1>
<h2 id="time_remain">Nächste Abstimmung in: </h2>
<button id="backButton" class="submitButton">Zurück zum Anfang</button> <button id="backButton" class="submitButton">Zurück zum Anfang</button>
</div> </div>
<script> <script>
document.getElementById("backButton").onclick = function() { document.getElementById("backButton").onclick = function() {
location.href = "/"; location.href = "/";
}; };
const zeroPad = (num, places) => String(num).padStart(places, '0')
// We can set endTime to whatever we want here (e.g. Midnight today )
// Use moment().endOf('day') to do this.
var dateFuture = new Date(2021, 00, 17, 0, 0);
// Show time remaining now.
showTimeRemaining();
// Set a timer to update the displayed clock every 1000 milliseconds.
setInterval(showTimeRemaining, 1000);
function showTimeRemaining() {
var dateNow = Date.now();
var days = zeroPad(Math.floor((dateFuture - dateNow) / (1000 * 60 * 60 * 24)), 2);
var hours = zeroPad(Math.floor(((dateFuture - dateNow) - days * 1000 * 60 * 60 * 24) / (1000 * 60 * 60)), 2);
var mins = zeroPad(Math.floor(((dateFuture - dateNow) - days * 1000 * 60 * 60 * 24 - hours * 1000 * 60 * 60) / (1000 * 60)), 2);
var secs = zeroPad(Math.floor(((dateFuture - dateNow) - days * 1000 * 60 * 60 * 24 - hours * 1000 * 60 * 60 - mins * 1000 * 60) / 1000), 2);
document.getElementById("time_remain").innerHTML = "Nächste Abstimmung in: " + days + "D " + hours + ":" + mins + ":" + secs;
console.log("Nächste Abstimmung in: " + days + "D " + hours + ":" + mins + ":" + secs);
}
</script> </script>
</body> </body>

View File

@@ -9,8 +9,8 @@
<body class="center-screen"> <body class="center-screen">
<div class="centered"> <div class="centered">
<h1>Das Voting wurde beendet!</h1> <h1>Du scheinst zu spät zu sein!</h1>
<h2>Informationen zu Votings sind der Adolfinumwebsite zu entnehmen</h2> <h2>Momentan findet kein Voting statt</h2>
<button id="backButton" class="submitButton">Zur Adolfinum Seite</button> <button id="backButton" class="submitButton">Zur Adolfinum Seite</button>
</div> </div>