-
Notifications
You must be signed in to change notification settings - Fork 152
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 #36 from edeandrea/add-event-stats-win-loss
Add additional win/loss details in event stats UI
- Loading branch information
Showing
16 changed files
with
250 additions
and
591 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions
48
...t-statistics/src/main/java/io/quarkus/sample/superheroes/statistics/domain/TeamScore.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,48 @@ | ||
package io.quarkus.sample.superheroes.statistics.domain; | ||
|
||
import java.util.StringJoiner; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
/** | ||
* Data class for a team score | ||
* <p> | ||
* The {@link RegisterForReflection @RegisterForReflection} annotation instructs the native compilation to allow reflection access to the class. Without it, the serialization/deserialization would not work when running the native executable. | ||
* </p> | ||
*/ | ||
@RegisterForReflection | ||
public class TeamScore { | ||
private final int heroWins; | ||
private final int villainWins; | ||
|
||
public TeamScore(int heroWins, int villainWins) { | ||
this.heroWins = heroWins; | ||
this.villainWins = villainWins; | ||
} | ||
|
||
public int getHeroWins() { | ||
return heroWins; | ||
} | ||
|
||
public int getVillainWins() { | ||
return villainWins; | ||
} | ||
|
||
public int getNumberOfFights() { | ||
return getHeroWins() + getVillainWins(); | ||
} | ||
|
||
public double getHeroWinRatio() { | ||
return ((double) this.heroWins / getNumberOfFights()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new StringJoiner(", ", TeamScore.class.getSimpleName() + "[", "]") | ||
.add("heroWins=" + heroWins) | ||
.add("villainWins=" + villainWins) | ||
.add("numberOfFights=" + getNumberOfFights()) | ||
.add("heroWinRatio=" + getHeroWinRatio()) | ||
.toString(); | ||
} | ||
} |
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
146 changes: 0 additions & 146 deletions
146
...src/test/java/io/quarkus/sample/superheroes/statistics/endpoint/TeamStatsWebSocketIT.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.