Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ResultInterface result = mj.deliberate(tally);

Install [maven](https://maven.apache.org), and run:

mvn test
mvn test -DtrimStackTrace=false

> Maven is available as a debian package: `apt install maven`

Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ apply plugin: 'java-library'

// In this section we declare where to find the dependencies of our project
repositories {
// Use jcenter for resolving our dependencies.
// We can declare any Maven/Ivy/file repository here.

// Use jcenter for resolving our dependencies.
//jcenter()

mavenCentral()
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ private Double adjustMeritToAffine(
BigInteger amountOfJudges,
int amountOfGrades
) {
if (maxMerit.compareTo(BigInteger.ZERO) == 0) {
return 0.0;
}

double meritNormalized = (new BigDecimal(merit).divide(
new BigDecimal(maxMerit), 15, RoundingMode.HALF_EVEN
)).doubleValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,22 @@ public void execute() throws Throwable {
assertTrue(caught, "An exception is raised");
}

@Test
@DisplayName("Allow no ballots")
void testNoBallots() {
Integer amountOfJudges = 0;
DeliberatorInterface mj = new MajorityJudgmentDeliberator();
TallyInterface tally =
new Tally(
new ProposalTallyInterface[]{
new ProposalTally(new Integer[]{0, 0, 0}),
new ProposalTally(new Integer[]{0, 0, 0}),
},
amountOfJudges
);
mj.deliberate(tally);
}

// …

/**
Expand Down
Loading