diff --git a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/RaceDTO.java b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/RaceDTO.java index 6a8e90c617f..defb2cbd23a 100755 --- a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/RaceDTO.java +++ b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/RaceDTO.java @@ -12,8 +12,6 @@ import com.sap.sailing.domain.common.RegattaNameAndRaceName; public class RaceDTO extends BasicRaceDTO { private static final long serialVersionUID = 2613189982608149975L; - public enum RaceLiveState { NOT_TRACKED, TRACKED, TRACKED_AND_LIVE, TRACKED_BUT_NOT_SCHEDULED }; - /** * Tells if this race is currently being tracked, meaning that a {@link RaceTracker} is * listening for incoming GPS fixes, mark passings etc., to update a {@link TrackedRace} object @@ -42,20 +40,6 @@ public class RaceDTO extends BasicRaceDTO { this.isTracked = isCurrentlyTracked; } - public RaceLiveState getLiveState(long serverTimePointAsMillis) { - RaceLiveState result = RaceLiveState.NOT_TRACKED; - if (trackedRace != null && trackedRace.hasGPSData && trackedRace.hasWindData) { - result = RaceLiveState.TRACKED; - if (isLive(serverTimePointAsMillis)) { - result = RaceLiveState.TRACKED_AND_LIVE; - if (startOfRace == null) { - result = RaceLiveState.TRACKED_BUT_NOT_SCHEDULED; - } - } - } - return result; - } - public RegattaAndRaceIdentifier getRaceIdentifier() { return new RegattaNameAndRaceName(regattaName, getName()); } diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/ScoringScheme.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/ScoringScheme.java index 1ed0b8a0c4c..825b3b1ab20 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/ScoringScheme.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/ScoringScheme.java @@ -71,11 +71,8 @@ public interface ScoringScheme extends Serializable { Integer numberOfCompetitorsInRace, NumberOfCompetitorsInLeaderboardFetcher numberOfCompetitorsInLeaderboardFetcher); /** - * @param o1 TODO * @param competitor1Scores scores of the first competitor, in the order of race columns in the leaderboard - * @param o2 TODO * @param competitor2Scores scores of the second competitor, in the order of race columns in the leaderboard - * @param timePoint TODO */ int compareByBetterScore(Competitor o1, List> competitor1Scores, Competitor o2, List> competitor2Scores, boolean nullScoresAreBetter, TimePoint timePoint); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/server/RaceContext.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/server/RaceContext.java index c2ad579e41e..24bb55b235d 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/server/RaceContext.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/server/RaceContext.java @@ -72,13 +72,17 @@ import com.sap.sse.gwt.dispatch.shared.commands.DTO; /** * This class aggregates race information by preparing {@link DTO}s for different components representing a race in the - * UI and providing convenience methods for several race state and other required information. + * UI and providing convenience methods for several race state and other required information.

+ * + * An object of this type represents a snapshot of a race for the time point when the object is created. Using the + * object at a later point in time will still represent the race at the time when this object was created, including + * the race's flag state, live state and view state. */ @GwtIncompatible public class RaceContext { private static final Logger logger = Logger.getLogger(RaceContext.class.getName()); - private static final long TIME_BEFORE_START_TO_SHOW_RACES_AS_LIVE = 60 * 60 * 1000; // 1 hour - private static final long TIME_TO_SHOW_CANCELED_RACES_AS_LIVE = 5 * 60 * 1000; // 5 min + private static final Duration TIME_BEFORE_START_TO_SHOW_RACES_AS_LIVE = Duration.ONE_HOUR; + private static final Duration TIME_TO_SHOW_CANCELED_RACES_AS_LIVE = Duration.ONE_MINUTE.times(5); private final TimePoint now = MillisecondsTimePoint.now(); private final LeaderboardContext leaderboardContext; private final Leaderboard leaderboard; @@ -537,7 +541,7 @@ public class RaceContext { RaceLogFlagEvent abortingFlagEvent = checkForAbortFlagEvent(); if (abortingFlagEvent != null) { TimePoint abortingTimeInPassBefore = abortingFlagEvent.getLogicalTimePoint(); - if (now.minus(abortingTimeInPassBefore.asMillis()).asMillis() < TIME_TO_SHOW_CANCELED_RACES_AS_LIVE) { + if (abortingTimeInPassBefore.until(now).compareTo(TIME_TO_SHOW_CANCELED_RACES_AS_LIVE) < 0) { result = true; // TODO: Problem: This causes the race added to the live races list without having a start time!!! // This does not work right now -> consider using a start time of the last pass.