Skip to content

Commit

Permalink
Merge pull request #403 from softwaremagico/400-chart-styling-is-not-…
Browse files Browse the repository at this point in the history
…correct

Fixed NPE
  • Loading branch information
softwaremagico authored May 7, 2024
2 parents 2f37ea9 + 02bd6d5 commit 44e8966
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/softwaremagico/KendoTournamentManager)](https://github.com/softwaremagico/KendoTournamentManager)
[![GitHub last commit](https://img.shields.io/github/last-commit/softwaremagico/KendoTournamentManager)](https://github.com/softwaremagico/KendoTournamentManager)
[![CircleCI](https://circleci.com/gh/softwaremagico/KendoTournamentManager.svg?style=shield)](https://circleci.com/gh/softwaremagico/KendoTournamentManager)
[![Time](https://img.shields.io/badge/development-607.5h-blueviolet.svg)]()
[![Time](https://img.shields.io/badge/development-608h-blueviolet.svg)]()

[![Powered by](https://img.shields.io/badge/powered%20by%20java-orange.svg?logo=OpenJDK&logoColor=white)]()
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=kendo-tournament-backend&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=kendo-tournament-backend)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void setCompetitor(Participant competitor) {
public void setDuelsDone() {
duelsDone = 0;
fights.forEach(fight -> {
if (fight.isOver() || countNotOver) {
if ((fight != null && fight.isOver()) || (fight != null && countNotOver)) {
duelsDone += fight.getDuels(competitor).size();
}
});
Expand All @@ -116,7 +116,7 @@ public void setDuelsDone() {
public void setDuelsWon() {
wonDuels = 0;
fights.forEach(fight -> {
if (fight.isOver() || countNotOver) {
if ((fight != null && fight.isOver()) || (fight != null && countNotOver)) {
wonDuels += fight.getDuelsWon(competitor);
}
});
Expand All @@ -125,7 +125,7 @@ public void setDuelsWon() {
public void setFightsWon() {
wonFights = 0;
for (final Fight fight : fights) {
if (fight.isOver() || countNotOver) {
if ((fight != null && fight.isOver()) || (fight != null && countNotOver)) {
if (fight.isWon(competitor)) {
wonFights++;
}
Expand All @@ -136,7 +136,7 @@ public void setFightsWon() {
public void setFightsDraw() {
drawFights = 0;
for (final Fight fight : fights) {
if (fight.isOver() || countNotOver) {
if ((fight != null && fight.isOver()) || (fight != null && countNotOver)) {
if (fight.getWinner() == null && (fight.getTeam1().isMember(competitor)
|| fight.getTeam2().isMember(competitor))) {
drawFights++;
Expand All @@ -148,8 +148,8 @@ public void setFightsDraw() {
public void setTotalFights() {
totalFights = 0;
for (final Fight fight : fights) {
if (fight.isOver() && fight.getTeam1().isMember(competitor)
|| fight.getTeam2().isMember(competitor)) {
if ((fight != null && fight.isOver() && fight.getTeam1().isMember(competitor))
|| (fight != null && fight.getTeam2().isMember(competitor))) {
totalFights++;
}
}
Expand All @@ -158,7 +158,7 @@ public void setTotalFights() {
public void setDuelsDraw() {
drawDuels = 0;
for (final Fight fight : fights) {
if (fight.isOver() || countNotOver) {
if ((fight != null && fight.isOver()) || (fight != null && countNotOver)) {
drawDuels += fight.getDrawDuels(competitor);
}
}
Expand All @@ -167,7 +167,9 @@ public void setDuelsDraw() {
public void setHits() {
hits = 0;
for (final Fight fight : fights) {
hits += fight.getScore(competitor);
if (fight != null) {
hits += fight.getScore(competitor);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class TournamentStatisticsComponent extends RbacBasedComponent implements
public teamSizeByTournament: LineChartData = new LineChartData();
public participantsByTournament: StackedBarChartData = new StackedBarChartData();
public hitsByTournament: StackedBarChartData = new StackedBarChartData();
public hitsByTournamentPercentage: StackedBarChartData = new StackedBarChartData();
public fightsOverData: GaugeChartData;

private readonly tournamentId: number | undefined;
Expand Down

0 comments on commit 44e8966

Please sign in to comment.