Removed code pass through
This commit is contained in:
+3
-9
@@ -173,7 +173,6 @@ public class VotingController {
|
|||||||
List<Motto> mottos = mottoRepository.findAll();
|
List<Motto> mottos = mottoRepository.findAll();
|
||||||
model.addAttribute("mottos", mottos);
|
model.addAttribute("mottos", mottos);
|
||||||
model.addAttribute("name", name);
|
model.addAttribute("name", name);
|
||||||
model.addAttribute("code", code);
|
|
||||||
return "mottoVoting.html";
|
return "mottoVoting.html";
|
||||||
} else if (addingPhase) {
|
} else if (addingPhase) {
|
||||||
PossibleCandidateWrapper possibleCandidates = new PossibleCandidateWrapper();
|
PossibleCandidateWrapper possibleCandidates = new PossibleCandidateWrapper();
|
||||||
@@ -184,13 +183,11 @@ public class VotingController {
|
|||||||
model.addAttribute("categories", categories);
|
model.addAttribute("categories", categories);
|
||||||
model.addAttribute("form", possibleCandidates);
|
model.addAttribute("form", possibleCandidates);
|
||||||
model.addAttribute("name", name);
|
model.addAttribute("name", name);
|
||||||
model.addAttribute("code", code);
|
|
||||||
return "addingCandidates.html";
|
return "addingCandidates.html";
|
||||||
} else if (votingPhase) {
|
} else if (votingPhase) {
|
||||||
List<Category> categories = categoryRepository.findAll();
|
List<Category> categories = categoryRepository.findAll();
|
||||||
model.addAttribute("categories", categories);
|
model.addAttribute("categories", categories);
|
||||||
model.addAttribute("name", name);
|
model.addAttribute("name", name);
|
||||||
model.addAttribute("code", code);
|
|
||||||
return "voting.html";
|
return "voting.html";
|
||||||
}
|
}
|
||||||
} else if (tokenStatus.equals("expired")) {
|
} else if (tokenStatus.equals("expired")) {
|
||||||
@@ -210,11 +207,10 @@ public class VotingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/saveCandidates")
|
@RequestMapping("/saveCandidates")
|
||||||
public String candidateSaving(@ModelAttribute PossibleCandidateWrapper possibleCandidates, @RequestParam String name, @RequestParam String code) {
|
public String candidateSaving(@ModelAttribute PossibleCandidateWrapper possibleCandidates, @RequestParam String name) {
|
||||||
if (voterRepository.findByEmail(name).getVote_status()) {
|
if (voterRepository.findByEmail(name).getVote_status()) {
|
||||||
return "errors/alreadyVoted.html";
|
return "errors/alreadyVoted.html";
|
||||||
} else {
|
} else {
|
||||||
authCodesRepository.delete(authCodesRepository.findByName(code));
|
|
||||||
LinkedList<PossibleCandidate> posCandidates = possibleCandidates.getPossibleCandidates();
|
LinkedList<PossibleCandidate> posCandidates = possibleCandidates.getPossibleCandidates();
|
||||||
long index = 1;
|
long index = 1;
|
||||||
for (PossibleCandidate posCandidate : posCandidates) {
|
for (PossibleCandidate posCandidate : posCandidates) {
|
||||||
@@ -236,12 +232,11 @@ public class VotingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/saveMotto")
|
@RequestMapping("/saveMotto")
|
||||||
public String mottoSaving(@RequestParam String name, @RequestParam String voteValue, @RequestParam String code) {
|
public String mottoSaving(@RequestParam String name, @RequestParam String voteValue) {
|
||||||
LOGGER.info(name);
|
LOGGER.info(name);
|
||||||
if (voterRepository.findByEmail(name).getMotto_status()) {
|
if (voterRepository.findByEmail(name).getMotto_status()) {
|
||||||
return "errors/alreadySubmitted.html";
|
return "errors/alreadySubmitted.html";
|
||||||
} else {
|
} else {
|
||||||
authCodesRepository.delete(authCodesRepository.findByName(code));
|
|
||||||
tableAction.voteForMotto(voteValue, mottoRepository);
|
tableAction.voteForMotto(voteValue, mottoRepository);
|
||||||
tableAction.updateMottoStatus(name, voterRepository);
|
tableAction.updateMottoStatus(name, voterRepository);
|
||||||
LOGGER.info(name + " has choose his motto");
|
LOGGER.info(name + " has choose his motto");
|
||||||
@@ -250,11 +245,10 @@ public class VotingController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/processVote")
|
@RequestMapping("/processVote")
|
||||||
public String ProcessVote(@RequestParam String name, @RequestParam String voteValues, @RequestParam String code) {
|
public String ProcessVote(@RequestParam String name, @RequestParam String voteValues) {
|
||||||
if (voterRepository.findByEmail(name).getCandidatesubmit_status()) {
|
if (voterRepository.findByEmail(name).getCandidatesubmit_status()) {
|
||||||
return "errors/alreadySubmitted.html";
|
return "errors/alreadySubmitted.html";
|
||||||
} else {
|
} else {
|
||||||
authCodesRepository.delete(authCodesRepository.findByName(code));
|
|
||||||
String[] partVoteValues = voteValues.split(",");
|
String[] partVoteValues = voteValues.split(",");
|
||||||
for (String s : partVoteValues) {
|
for (String s : partVoteValues) {
|
||||||
tableAction.voteForCandidate(s, candidateRepository);
|
tableAction.voteForCandidate(s, candidateRepository);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class TableAction {
|
|||||||
try {
|
try {
|
||||||
AuthCode authCode = authCodesRepository.findByName(name);
|
AuthCode authCode = authCodesRepository.findByName(name);
|
||||||
if (authCode.getCode().equals(code) && !authCode.isExpired()) {
|
if (authCode.getCode().equals(code) && !authCode.isExpired()) {
|
||||||
|
authCodesRepository.delete(authCode);
|
||||||
return "matched";
|
return "matched";
|
||||||
} else if (authCode.isExpired()) {
|
} else if (authCode.isExpired()) {
|
||||||
authCodesRepository.delete(authCode);
|
authCodesRepository.delete(authCode);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h2.categoryCategory {
|
h2.categoryCategory {
|
||||||
|
color: #bb1515;
|
||||||
margin-top: 5%;
|
margin-top: 5%;
|
||||||
margin-bottom: 1%;
|
margin-bottom: 1%;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user