record wind fix only if it's between startOfTracking and endOfTracking or either of those is null

This commit is contained in:
Axel Uhl committed 2013-03-07 09:08:54 +04:00
1 parent c3ea5cb602
commit badcaaf6ca
1 file changed
+6 -3
@@ -568,10 +568,13 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
@Override
public void recordWind(Wind wind, WindSource windSource) {
TimePoint endOfRace = getEndOfRace();
// TODO check what a good filter is; remember that start/end of tracking may change over time; what if we have discarded valuable wind fixes?
TimePoint startOfTracking = getStartOfTracking();
TimePoint endOfTracking = getEndOfTracking();
// record wind fix only if it's still within reasonable time after the race has ended or the race hasn't ended yet
if (endOfRace == null
|| endOfRace.plus(TimingConstants.IS_LIVE_GRACE_PERIOD_IN_MILLIS).before(wind.getTimePoint())) {
if (startOfTracking == null || endOfTracking == null
|| (startOfTracking.before(wind.getTimePoint()) &&
endOfTracking.plus(TimingConstants.IS_LIVE_GRACE_PERIOD_IN_MILLIS).before(wind.getTimePoint()))) {
getOrCreateWindTrack(windSource).add(wind);
updated(/* time point */null); // wind events shouldn't advance race time
triggerManeuverCacheRecalculationForAllCompetitors();