mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-11 13:22:43 +00:00
avoid NPEs in case no certificate or no corrected time available
Change-Id: I1ba8065b4d2345ec347e5c2dd35d9cc231d4a311
This commit is contained in:
1 parent
0c9cc256c7
commit
72ed2fd197
2 files changed
+10
-6
No files matched your search
+2
-2
@@ -133,14 +133,14 @@ public enum BoatClassMasterdata {
|
||||
X_99 ("X-99", true, 9.96, 2.95, BoatHullType.MONOHULL, true, "X99"),
|
||||
|
||||
// multi-class "boat classes"; to be replaced at some later point in time by something like a RegattaClass
|
||||
ORC ("ORC", true, 13.83, 3.91, BoatHullType.MONOHULL, true),
|
||||
ORC ("ORC", true, 13.83, 3.91, BoatHullType.MONOHULL, true, "ORC I", "ORC II", "ORC III", "ORC IV", "ORC III+IV"),
|
||||
ORC_CLUB ("ORC Club", true, 13.83, 3.91, BoatHullType.MONOHULL, true),
|
||||
ORC_INTERNATIONAL ("ORC International", true, 13.83, 3.91, BoatHullType.MONOHULL, true, "ORC Int."),
|
||||
|
||||
// Performance Handicap Racing Fleet (PHRF) is a handicap system used for racing in North America
|
||||
PHRF ("PHRF", true, 13.83, 3.91, BoatHullType.MONOHULL, true),
|
||||
|
||||
// a 'boat class' to track runners at runnng events
|
||||
// a 'boat class' to track runners at running events
|
||||
RUNNING ("Runner", true, 1.0, 1.0, BoatHullType.NO_HULL, false, "Running");
|
||||
|
||||
private final String displayName;
|
||||
|
||||
+8
-4
@@ -475,7 +475,7 @@ public class ORCPerformanceCurveRankingMetric extends AbstractRankingMetric {
|
||||
competitorRankingInfo.put(competitor, new CompetitorRankingInfoImpl(
|
||||
timePoint, competitor, getWindwardDistanceTraveled(competitor, timePoint, cache),
|
||||
actualRaceDuration, correctedTime,
|
||||
actualRaceDuration.plus(correctedTime),
|
||||
correctedTime == null ? null : actualRaceDuration.plus(correctedTime),
|
||||
correctedTime));
|
||||
}
|
||||
}
|
||||
@@ -497,9 +497,13 @@ public class ORCPerformanceCurveRankingMetric extends AbstractRankingMetric {
|
||||
final Competitor leader = rankingInfo.getLeaderByCorrectedEstimatedTimeToCompetitorFarthestAhead();
|
||||
try {
|
||||
final ORCPerformanceCurve competitorPerformanceCurve = getPerformanceCurveForPartialCourse(competitor, rankingInfo.getTimePoint(), cache);
|
||||
final Speed impliedWindOfLeader = getImpliedWind(leader, rankingInfo.getTimePoint(), cache);
|
||||
final Duration allowanceForLeaderInCompetitorsPerformanceCurve = competitorPerformanceCurve.getAllowancePerCourse(impliedWindOfLeader);
|
||||
result = actualRaceDuration.minus(allowanceForLeaderInCompetitorsPerformanceCurve);
|
||||
if (competitorPerformanceCurve == null) {
|
||||
result = null;
|
||||
} else {
|
||||
final Speed impliedWindOfLeader = getImpliedWind(leader, rankingInfo.getTimePoint(), cache);
|
||||
final Duration allowanceForLeaderInCompetitorsPerformanceCurve = competitorPerformanceCurve.getAllowancePerCourse(impliedWindOfLeader);
|
||||
result = actualRaceDuration.minus(allowanceForLeaderInCompetitorsPerformanceCurve);
|
||||
}
|
||||
} catch (FunctionEvaluationException | MaxIterationsExceededException e) {
|
||||
logger.log(Level.WARNING, "Problem evaluating performance curve for competitor "+competitor+" for time point "+rankingInfo.getTimePoint(), e);
|
||||
result = null;
|
||||
|
||||
Reference in new issue
Block a user