Prepared everything for the votings

This commit is contained in:
2021-01-17 15:54:32 +01:00
parent ab3a36859a
commit ddf670cc94
6 changed files with 1669 additions and 563 deletions

View File

@@ -52,8 +52,8 @@ public class VotingController {
@PostConstruct
public void init() {
votingPhase = false;
addingPhase = true;
votingPhase = true;
addingPhase = false;
LOGGER.info("Program started with arguments: votingPhase="+ votingPhase + " addingPhase=" + addingPhase);

View File

@@ -99,7 +99,7 @@ public class TableAction {
Collections.sort(possibleCandidatesPerCategory, Comparator.comparing(PossibleCandidate::getVotes));
Collections.reverse(possibleCandidatesPerCategory);
for (int j = 0; j < getLimit(possibleCandidatesPerCategory); j++){
if (j >= 10 && possibleCandidatesPerCategory.get(j).getVotes() == possibleCandidatesPerCategory.get(j-1).getVotes()){
if (j >= 10 && possibleCandidatesPerCategory.get(j).getVotes() == possibleCandidatesPerCategory.get(9).getVotes()){
Candidate candidate = new Candidate(possibleCandidatesPerCategory.get(j).getName(), possibleCandidatesPerCategory.get(j).getCategory());
candidateRepository.save(candidate);
}

View File

@@ -42,7 +42,8 @@ button {
}
.submitButton {
margin-top: 5%;
margin-top: 2%;
margin-bottom: 5%;
padding: .25em 0;
border: 0;
outline: 0;
@@ -56,6 +57,23 @@ button {
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
@media only screen and (max-device-width: 480px) {
.submitButton {
margin-top: 2%;
padding: .25em 0;
border: 0;
outline: 0;
background: rgb(6, 216, 136);
color: rgba(255, 255, 255, 0.85);
font-size: 2rem;
width: 500px;
letter-spacing: .0625rem;
border-radius: 12px;
box-shadow: 0 3px 5px 1px rgba(0, 0, 0, 0.25);
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
}
html,
body {
width: 100%;

View File

@@ -8,38 +8,15 @@
</head>
<body class="center-screen">
<div class="centered">
<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>
</div>
<div class="centered">
<h1>Du hast schon abgestimmt!</h1>
<button id="backButton" class="submitButton">Zurück zum Anfang</button>
</div>
<script>
<script>
document.getElementById("backButton").onclick = function() {
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>
</body>