This commit is contained in:
2020-12-10 23:57:47 +01:00

View File

@@ -6,6 +6,7 @@ import com.github.cato447.AbizeitungVotingSystem.helper.RandomNumber;
import com.github.cato447.AbizeitungVotingSystem.repositories.*; import com.github.cato447.AbizeitungVotingSystem.repositories.*;
import com.github.cato447.AbizeitungVotingSystem.table.TableAction; import com.github.cato447.AbizeitungVotingSystem.table.TableAction;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@@ -23,9 +24,15 @@ import java.util.*;
@Controller @Controller
public class VotingController { public class VotingController {
private boolean votingPhase; @Value("$(voting)")
private boolean mottoPhase; private String voting;
private boolean addingPhase; @Value("$(motto)")
private String motto;
@Value("$(adding)")
private String adding;
private Boolean votingPhase = false, mottoPhase = false, addingPhase = false;
private static final Logger LOGGER = LogManager.getLogger(VotingController.class); private static final Logger LOGGER = LogManager.getLogger(VotingController.class);
private TableAction tableAction = new TableAction(); private TableAction tableAction = new TableAction();
@@ -54,31 +61,19 @@ public class VotingController {
@PostConstruct @PostConstruct
public void init() { public void init() {
try { if (voting != null) {
String votingPhaseConfig = System.getProperty("votingPhase");
if (votingPhaseConfig.equalsIgnoreCase("true")) {
votingPhase = true; votingPhase = true;
} } else if (adding != null) {
addingPhase = true;
String mottoVotingConfig = System.getProperty("mottoVoting"); } else if (motto != null) {
if (mottoVotingConfig.equalsIgnoreCase("true")) {
mottoPhase = true; mottoPhase = true;
} }
String addingPhaseConfig = System.getProperty("addingPhase");
if (addingPhaseConfig.equalsIgnoreCase("true")){
addingPhase = true;
}
} catch (Exception e){
}
// //TODO: TESTING REMOVE ON SHIPPING // //TODO: TESTING REMOVE ON SHIPPING
// votingPhase = false; // votingPhase = false;
// mottoPhase = true; // mottoPhase = true;
// addingPhase = false; // addingPhase = false;
LOGGER.info("Program started with arguments: votingPhase="+ votingPhase + " mottoVoting=" + mottoPhase + " addingPhase=" + addingPhase); LOGGER.info("Program started with arguments: votingPhase=" + votingPhase + " mottoPhase=" + mottoPhase + " addingPhase=" + addingPhase);
if (voterRepository.findAll().size() == 0) { if (voterRepository.findAll().size() == 0) {
tableAction.setUpVoters(voterRepository); tableAction.setUpVoters(voterRepository);