mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 05:11:04 +00:00
fixed NPEs for editable leaderboard in case a new untracked column is added
This commit is contained in:
1 parent
f5804520df
commit
8a4707ecf0
2 files changed
+19
-14
No files matched your search
+7
-12
@@ -219,18 +219,13 @@ public class LeaderboardImpl implements Named, Leaderboard {
|
||||
|
||||
@Override
|
||||
public Entry getEntry(Competitor competitor, RaceInLeaderboard race, TimePoint timePoint) throws NoWindException {
|
||||
Entry result;
|
||||
if (race.getTrackedRace() != null) {
|
||||
int trackedPoints = getTrackedPoints(competitor, race, timePoint);
|
||||
final Result correctedResults = getScoreCorrection().getCorrectedScore(trackedPoints, competitor, race, timePoint);
|
||||
boolean discarded = isDiscarded(competitor, race, timePoint);
|
||||
return new EntryImpl(trackedPoints, correctedResults.getCorrectedScore(),
|
||||
discarded ? 0 : correctedResults.getCorrectedScore() * (race.isMedalRace()?2:1),
|
||||
correctedResults.getMaxPointsReason(), discarded);
|
||||
} else {
|
||||
result = new EntryImpl(/* trackedPoints */ 0, /* net points */ 0, /* total points */ 0, MaxPointsReason.NONE, /* discarded */ false);
|
||||
}
|
||||
return result;
|
||||
int trackedPoints = getTrackedPoints(competitor, race, timePoint);
|
||||
final Result correctedResults = getScoreCorrection().getCorrectedScore(trackedPoints, competitor, race,
|
||||
timePoint);
|
||||
boolean discarded = isDiscarded(competitor, race, timePoint);
|
||||
return new EntryImpl(trackedPoints, correctedResults.getCorrectedScore(), discarded ? 0
|
||||
: correctedResults.getCorrectedScore() * (race.isMedalRace() ? 2 : 1),
|
||||
correctedResults.getMaxPointsReason(), discarded);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-2
@@ -14,6 +14,7 @@ import com.google.gwt.cell.client.SelectionCell;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.Pair;
|
||||
|
||||
@@ -137,7 +138,11 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
String reasonForMaxPoints = object.fieldsByRaceName.get(raceName).reasonForMaxPoints;
|
||||
LeaderboardEntryDAO leaderboardEntryDAO = object.fieldsByRaceName.get(raceName);
|
||||
String reasonForMaxPoints = null;
|
||||
if (leaderboardEntryDAO != null) {
|
||||
reasonForMaxPoints = leaderboardEntryDAO.reasonForMaxPoints;
|
||||
}
|
||||
return reasonForMaxPoints == null ? "" : reasonForMaxPoints;
|
||||
}
|
||||
}
|
||||
@@ -189,7 +194,12 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
return ""+object.fieldsByRaceName.get(raceName).netPoints;
|
||||
LeaderboardEntryDAO leaderboardEntryDAO = object.fieldsByRaceName.get(raceName);
|
||||
String result = "";
|
||||
if (leaderboardEntryDAO != null) {
|
||||
result = result+leaderboardEntryDAO.netPoints;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user