mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-27 07:56:38 +00:00
Merge branch 'master' into foiling
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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<Util.Pair<RaceColumn, Double>> competitor1Scores, Competitor o2, List<Util.Pair<RaceColumn, Double>> competitor2Scores, boolean nullScoresAreBetter, TimePoint timePoint);
|
||||
|
||||
+8
-4
@@ -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.<p>
|
||||
*
|
||||
* 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.
|
||||
|
||||
Reference in New Issue
Block a user