mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-29 23:37:10 +00:00
moved assertion where it belongs: don't compare windward distances when one competitor has already finished the leg;
the marks may move, hence giving different windward distances for different time points for the same leg
This commit is contained in:
1 parent
d19b853152
commit
d7a3fca6eb
1 file changed
+2
-2
+2
-2
@@ -493,8 +493,6 @@ public abstract class AbstractRankingMetric implements RankingMetric {
|
||||
WindLegTypeAndLegBearingCache cache) {
|
||||
assert legWho.hasStartedLeg(timePoint);
|
||||
assert legTo.hasStartedLeg(timePoint);
|
||||
assert getWindwardDistanceTraveled(legTo.getCompetitor(), legTo.hasFinishedLeg(timePoint)?legTo.getFinishTime():timePoint, cache).compareTo(
|
||||
getWindwardDistanceTraveled(legWho.getCompetitor(), legWho.hasFinishedLeg(timePoint)?legWho.getFinishTime():timePoint, cache)) >= 0;
|
||||
final Duration toEndOfLegOrTo;
|
||||
if (legTo.hasFinishedLeg(timePoint)) {
|
||||
// calculate actual time it takes who to reach the end of the leg starting at timePoint:
|
||||
@@ -503,6 +501,8 @@ public abstract class AbstractRankingMetric implements RankingMetric {
|
||||
// who's leg finishing time is known; we don't need to extrapolate
|
||||
toEndOfLegOrTo = timePoint.until(whosLegFinishTime);
|
||||
} else {
|
||||
assert getWindwardDistanceTraveled(legTo.getCompetitor(), legTo.hasFinishedLeg(timePoint)?legTo.getFinishTime():timePoint, cache).compareTo(
|
||||
getWindwardDistanceTraveled(legWho.getCompetitor(), legWho.hasFinishedLeg(timePoint)?legWho.getFinishTime():timePoint, cache)) >= 0;
|
||||
// estimate who's leg finishing time by extrapolating with the average VMG (if available) or the current VMG
|
||||
// (if no average VMG can currently be computed, e.g., because the time point is exactly at the leg start)
|
||||
final Position windwardPositionToReachInWhosCurrentLeg =
|
||||
|
||||
Reference in new issue
Block a user