Skip to content

Commit

Permalink
new GUI modal: tabulation confirmation page (#812)
Browse files Browse the repository at this point in the history
* new GUI modal: tabulation confirmation page

* open in finder after tabulation; handle new file creation

* handle edge casess: trim CSV ranking, handle moved config file

* handle tabulation success/failure/in-progress states

* lint

* exclude spotbugs error

* UI updates

* three-step gui tabulation

* don't allow change in ballot stats between loading and tabulating

* gui improvements / timing

* style updates

* make the log output faster, and add colors too (#832)

* make the log output faster, and add colors too

* spruce up the style

* Issue 830: prevent lagging

* remove unused import

* re-enable and fix word wrap

* better warning color

---------

Co-authored-by: Armin Samii <armin.samii@gmail.com>

* comma-separate large number of ballots

* Fixes unreliable usage of `.isEmpty()` for Strings in favor of `.isBlank()`; removes "please" from user comms per Google style; addresses nits, minor refactoring, and other clean-up.

* address PR comments

* only pop up tabulate window if validation passes

* Update error message, other PR comments

* Fixes bug with `buttonOpenResultsClicked` not opening window to correct location in Windows; fit and finish.

* address PR comments

* delete temp file on Tabulate Window close

* Nits.

* PR updates

---------

Co-authored-by: Armin Samii <armin.samii@gmail.com>
Co-authored-by: HEdingfield <hylton@groupagree.com>
  • Loading branch information
3 people authored Jun 11, 2024
1 parent b3d960f commit 6171d29
Show file tree
Hide file tree
Showing 14 changed files with 867 additions and 97 deletions.
13 changes: 13 additions & 0 deletions config/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,17 @@
<Field name="xmlns"/>
<Bug code="UrF"/>
</Match>
<Match>
<Class name="~network\.brightspots\.rcv\.GuiTabulateController"/>
<Method name="initialize"/>
<Bug code="EI2"/>
</Match>
<Match>
<Class name="~network\.brightspots\.rcv\.TabulatorSession\$LoadedCvrData"/>
<Bug code="EI2"/>
</Match>
<Match>
<Class name="~network\.brightspots\.rcv\.TabulatorSession\$LoadedCvrData"/>
<Bug code="EI"/>
</Match>
</FindBugsFilter>
6 changes: 3 additions & 3 deletions src/main/java/network/brightspots/rcv/ContestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ Set<ValidationError> validate() {
Logger.info("Contest config validation successful.");
} else {
Logger.severe(
"Contest config validation failed! Please modify the contest config file and try again.\n"
"Contest config validation failed! Modify the contest config file and try again.\n"
+ "See config_file_documentation.txt for more details.");
}
return validationErrors;
Expand Down Expand Up @@ -545,8 +545,8 @@ private void validateOutputSettings() {
Logger.severe(
"To ensure read-only access to RCTab output files, users must not"
+ " set the output path to user account folders like Documents,"
+ " Desktop, etc. -- any path under \"%s\" is prohibited. Please"
+ " specify a new path outside this folder in the Output tab of the"
+ " Desktop, etc. -- any path under \"%s\" is prohibited."
+ " Specify a new path outside this folder in the Output tab of the"
+ " app (e.g. C:\\RCTab\\output).",
rootUsersDirectory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static void migrateConfigVersion(ContestConfig config)
WinnerElectionMode.MULTI_SEAT_SEQUENTIAL_WINNER_TAKES_ALL.getInternalLabel();
default -> {
Logger.warning(
"winnerElectionMode \"%s\" is unrecognized! Please supply a valid "
"winnerElectionMode \"%s\" is unrecognized! Supply a valid "
+ "winnerElectionMode.",
oldWinnerElectionMode);
rules.winnerElectionMode = null;
Expand Down Expand Up @@ -123,8 +123,7 @@ static void migrateConfigVersion(ContestConfig config)
rules.tiebreakMode = tiebreakModeMigrationMap.get(oldTiebreakMode).getInternalLabel();
} else {
Logger.warning(
"tiebreakMode \"%s\" is unrecognized! Please supply a valid tiebreakMode.",
oldTiebreakMode);
"tiebreakMode \"%s\" is unrecognized! Supply a valid tiebreakMode.", oldTiebreakMode);
rules.tiebreakMode = null;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/network/brightspots/rcv/CsvCvrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void readCastVoteRecords(List<CastVoteRecord> castVoteRecords)
}
int rankAsInt;
try {
rankAsString = rankAsString.trim();
rankAsInt = Integer.parseInt(rankAsString);
} catch (NumberFormatException e) {
Logger.severe(
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/network/brightspots/rcv/DominionCvrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ private int parseCvrFile(
String batchId = session.get("BatchId").toString();
Integer recordId = (Integer) session.get("RecordId");
String suppliedId = recordId.toString();
String computedId = Stream.of(tabulatorId, batchId, Integer.toString(recordId))
.filter(s -> s != null && !s.isEmpty())
String computedId =
Stream.of(tabulatorId, batchId, Integer.toString(recordId))
.filter(s -> s != null && !s.isBlank())
.collect(Collectors.joining("|"));

// filter out records which are not current and replace them with adjudicated ones
Expand Down
Loading

0 comments on commit 6171d29

Please sign in to comment.