-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raire service responses #67
Conversation
package au.org.democracydevelopers.raireservice.response; | ||
|
||
import au.org.democracydevelopers.raire.algorithm.RaireResult; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can write "Get Assertions Request" as "GetAssertionsRequest"?
raire -> raire-java
* (risk limit, and an array of current risk estimates, one for each assertion). | ||
*/ | ||
public final Metadata metadata; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raire -> raire-java
import au.org.democracydevelopers.raireservice.request.GetAssertionsRequest; | ||
import java.math.BigDecimal; | ||
import java.util.List; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Get Assertions Response" -> "GetAssertionsResponse"
* The contest name. | ||
*/ | ||
public final String contest; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't quite understand the comment "This is expected .... doest not need to be"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just meant that Colorado typically has the same risk limit for all the contests under audit (usually 3%) but that, in principle, raire-java will happily compute different difficulties as a function of an individual-contest risk limit. (I was justifying having a separate risk limit as part of the query for each contest, when everyone in colorado knows that it's always 3%). I have now tried to make this clearer.
* but for raire it really does not need to be. | ||
*/ | ||
public final BigDecimal riskLimit; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than saying "This is constantly ... process" perhaps clarify that the current risk estimates for each assertion are constantly updated in the database for each assertion by colorado-rla.
} | ||
|
||
public enum RaireErrorCodes { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a javadoc comment above the enum definition?
Also, where raire/RAIRE is used, should we say raire-java since this is what will actually be generating the assertions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that generally distinguishing 'raire-java' from the 'raire-service' from 'raire in general' is a good idea. I've changed this where you pointed it out (or where I noticed) but might not have got them all (yet).
*/ | ||
INTERNAL_ERROR, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"out of a raire-java error"
assertTrue(StringUtils.containsIgnoreCase(msg, "Candidate list does not match database")); | ||
assertEquals(RaireErrorCodes.WRONG_CANDIDATE_NAMES, e.errorCode); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raire -> raire-java (also see later uses of raire)
Typo on elimination
* or timeout generating assertions. | ||
*/ | ||
public class GenerateAssertionsException extends Exception { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a comment for errorCode?
// This should be part of Issue https://github.com/DemocracyDevelopers/raire-service/issues/44 | ||
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException ex) { | ||
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage()); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: repository
This does error handling for the GenerateAssertions endpoint, for #41. This involves quite a lot of converting from raire-java errors. It also does #53.
The testing isn't yet ideal, because we don't really have a way of making most of the errors we're translating. More tests will make sense when #44 and #45 are done.