forked from cdos-rla/colorado-rla
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from DemocracyDevelopers/100-persist-irvballo…
…tinterpretation 100 persist irvballotinterpretation
- Loading branch information
Showing
34 changed files
with
766 additions
and
2,707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
...oject/src/main/java/au/org/democracydevelopers/corla/model/GenerateAssertionsSummary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
Democracy Developers IRV extensions to colorado-rla. | ||
@copyright 2024 Colorado Department of State | ||
These IRV extensions are designed to connect to a running instance of the raire | ||
service (https://github.com/DemocracyDevelopers/raire-service), in order to | ||
generate assertions that can be audited using colorado-rla. | ||
The colorado-rla IRV extensions are free software: you can redistribute it and/or modify it under the terms | ||
of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
version 3 of the License, or (at your option) any later version. | ||
The colorado-rla IRV extensions are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
See the GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License along with | ||
raire-service. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package au.org.democracydevelopers.corla.model; | ||
|
||
import org.apache.log4j.LogManager; | ||
import org.apache.log4j.Logger; | ||
|
||
import javax.persistence.*; | ||
|
||
import static java.util.Collections.min; | ||
|
||
|
||
/** | ||
* RAIRE (raire-java) generates a set of assertions for a given IRV contest, but it also returns | ||
* the winner and (possibly) an informative error. These are stored in the database, which | ||
* colorado-rla needs to read in order to produce IRV reports. This is read-only table here, with | ||
* data identical to the corresponding class in raire-service. | ||
*/ | ||
@Entity | ||
@Table(name = "generate_assertions_summary") | ||
public class GenerateAssertionsSummary { | ||
|
||
/** | ||
* Class-wide logger. | ||
*/ | ||
private static final Logger LOGGER = LogManager.getLogger(GenerateAssertionsSummary.class); | ||
|
||
/** | ||
* ID. | ||
*/ | ||
@Id | ||
@Column(updatable = false, nullable = false) | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private long id; | ||
|
||
/** | ||
* Version. Used for optimistic locking. | ||
*/ | ||
@Version | ||
@Column(name = "version", updatable = false, nullable = false) | ||
private long version; | ||
|
||
/** | ||
* Name of the contest. | ||
*/ | ||
@Column(name = "contest_name", unique = true, updatable = false, nullable = false) | ||
public String contestName; | ||
|
||
/** | ||
* Name of the winner of the contest, as determined by raire-java. | ||
*/ | ||
@Column(name = "winner", updatable = false, nullable = false) | ||
public String winner; | ||
|
||
/** | ||
* An error (matching one of the RaireServiceErrors.RaireErrorCodes), if there was one. Errors | ||
* mean there are no assertions (nor winner), but some warnings | ||
* (e.g. TIME_OUT_TRIMMING_ASSERTIONS) do have assertions and a winner, and allow the audit to | ||
* continue. | ||
*/ | ||
@Column(name = "error", updatable = false, nullable = false) | ||
public String error; | ||
|
||
/** | ||
* A warning, if there was one, or emptystring if none. Warnings (e.g. TIME_OUT_TRIMMING_ASSERTIONS) | ||
* mean that assertion generation succeeded and the audit can continue, but re-running with longer | ||
* time allowed might be beneficial. | ||
*/ | ||
@Column(name = "warning", updatable = false, nullable = false) | ||
public String warning; | ||
|
||
/** | ||
* The message associated with the error, for example the names of the tied winners. | ||
*/ | ||
@Column(name = "message", updatable = false, nullable = false) | ||
public String message; | ||
|
||
/** | ||
* Default no-args constructor (required for persistence). | ||
*/ | ||
public GenerateAssertionsSummary() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.