Skip to content

Commit

Permalink
style updates
Browse files Browse the repository at this point in the history
  • Loading branch information
artoonie committed May 30, 2024
1 parent 718efc3 commit 83b58eb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ protected Boolean call() {
if (errors.isEmpty()) {
succeeded();
} else {
Logger.warning("There were errors");
Logger.warning("Encountered %d errors during tabulation.", errors.size());
failed();
}
return errors.isEmpty();
Expand Down Expand Up @@ -1857,7 +1857,7 @@ protected LoadedCvrData call() {
if (cvrStatics.successfullyReadAll) {
succeeded();
} else {
Logger.warning("There were errors");
Logger.warning("Failed to read all CVRs.");
failed();
}
return cvrStatics;
Expand Down
31 changes: 15 additions & 16 deletions src/main/java/network/brightspots/rcv/GuiTabulateController.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@ public class GuiTabulateController {
private String configOutputPath;

/**
* This modal builds upon the GuiConfigController, and therefore only interacts with it.
* This modal builds upon the GuiConfigController, and the two share some functionality
* (e.g. saving a config file). The shared functionality lives in GuiConfigController.
*/
private GuiConfigController guiConfigController;

/**
* The style applied when a field is filled.
* The style applied when a required field is correctly filled.
*/
private String filledFieldStyle;

/**
* The style applied when a field is unfilled.
* The style applied when a required field is unfilled and requires user input.
*/
private String unfilledFieldStyle;

Expand Down Expand Up @@ -143,15 +144,10 @@ public void nameUpdated(KeyEvent keyEvent) {
*/
public void buttonloadCvrsClicked(ActionEvent actionEvent) {
String configPath = getConfigPathOrCreateTempFile();
ContestConfig config = ContestConfig.loadContestConfig(configPath);
configOutputPath = config.getOutputDirectory();
if (!configOutputPath.endsWith("/")) {
configOutputPath += "/";
}

enableButtonsUpTo(null);
Service<LoadedCvrData> service = guiConfigController.parseAndCountCastVoteRecords(configPath);
// Dispatch a function that watches the service and updates the progress bar

watchParseCvrServiceProgress(service);
}

Expand All @@ -162,15 +158,10 @@ public void buttonloadCvrsClicked(ActionEvent actionEvent) {
*/
public void buttonTabulateClicked(ActionEvent actionEvent) {
String configPath = getConfigPathOrCreateTempFile();
ContestConfig config = ContestConfig.loadContestConfig(configPath);
configOutputPath = config.getOutputDirectory();
if (!configOutputPath.endsWith("/")) {
configOutputPath += "/";
}

Service<Boolean> service = guiConfigController.startTabulation(
configPath, userNameField.getText(), useTemporaryConfigBeforeTabulation, lastLoadedCvrData);
// Dispatch a function that watches the service and updates the progress bar

watchTabulatorServiceProgress(service);
}

Expand Down Expand Up @@ -295,9 +286,17 @@ public void buttonTempSaveClicked(ActionEvent actionEvent) {
}

private String getConfigPathOrCreateTempFile() {
return useTemporaryConfigBeforeTabulation
String path = useTemporaryConfigBeforeTabulation
? guiConfigController.saveFile(tempSaveButton, true)
: savedConfigFilePath;

ContestConfig config = ContestConfig.loadContestConfig(path);
configOutputPath = config.getOutputDirectory();
if (!configOutputPath.endsWith("/")) {
configOutputPath += "/";
}

return path;
}

private boolean isConfigSavedOrTempFileReady() {
Expand Down

0 comments on commit 83b58eb

Please sign in to comment.