Merge remote-tracking branch 'origin/testing' into testing

This commit is contained in:
2021-01-27 18:26:40 +01:00
4 changed files with 28 additions and 33 deletions
@@ -52,8 +52,8 @@ public class VotingController {
@PostConstruct @PostConstruct
public void init() { public void init() {
votingPhase = false; votingPhase = true;
addingPhase = true; addingPhase = false;
LOGGER.info("Program started with arguments: votingPhase="+ votingPhase + " addingPhase=" + addingPhase); LOGGER.info("Program started with arguments: votingPhase="+ votingPhase + " addingPhase=" + addingPhase);
@@ -76,7 +76,7 @@ public class VotingController {
@RequestMapping("/") @RequestMapping("/")
public String WelcomeSite() { public String WelcomeSite() {
LocalDate finishDate = LocalDate.of(2021, Month.JANUARY,17); LocalDate finishDate = LocalDate.of(2021, Month.JANUARY,24);
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
if(now.isAfter(finishDate)){ if(now.isAfter(finishDate)){
@@ -99,7 +99,7 @@ public class TableAction {
Collections.sort(possibleCandidatesPerCategory, Comparator.comparing(PossibleCandidate::getVotes)); Collections.sort(possibleCandidatesPerCategory, Comparator.comparing(PossibleCandidate::getVotes));
Collections.reverse(possibleCandidatesPerCategory); Collections.reverse(possibleCandidatesPerCategory);
for (int j = 0; j < getLimit(possibleCandidatesPerCategory); j++){ 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()); Candidate candidate = new Candidate(possibleCandidatesPerCategory.get(j).getName(), possibleCandidatesPerCategory.get(j).getCategory());
candidateRepository.save(candidate); candidateRepository.save(candidate);
} }
+19 -1
View File
@@ -42,7 +42,8 @@ button {
} }
.submitButton { .submitButton {
margin-top: 5%; margin-top: 2%;
margin-bottom: 5%;
padding: .25em 0; padding: .25em 0;
border: 0; border: 0;
outline: 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); 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, html,
body { body {
width: 100%; width: 100%;
@@ -10,7 +10,6 @@
<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>
@@ -18,28 +17,6 @@
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>