Merge branch 'master' into bug3881

This commit is contained in:
Steffen Schaefer committed 2016-10-26 08:44:57 +02:00
commit d622f1e350
5 files changed
+19 -1

No files matched your search

@@ -82,3 +82,4 @@ WindwardDistanceToAdvantageousEndOfLine=Windward Distance to Advantageous End of
RankAfterHalfOfTheFirstLeg=Rank after the half of the first leg
AdvantageousEndOfLine=Advantageous End of Line
TimeSpentInSeconds=Time Spent in Seconds
MedalRace=Medal Race
@@ -82,3 +82,4 @@ WindwardDistanceToAdvantageousEndOfLine=Windw
RankAfterHalfOfTheFirstLeg=Platzierung nach der Hälfte des ersten Schenkels
AdvantageousEndOfLine=Bevorteiltes Ende der Startlinie
TimeSpentInSeconds=Benötigte Zeit in Sekunden
MedalRace=Medaillenrennen
@@ -40,6 +40,9 @@ public interface HasTrackedRaceContext {
@Dimension(messageKey="AdvantageousEndOfLine", ordinal=6)
public NauticalSide getAdvantageousEndOfLine();
@Dimension(messageKey="MedalRace", ordinal=7)
public Boolean isMedalRace();
@Dimension(messageKey="IsTracked", ordinal=7)
public Boolean isTracked();
@@ -99,6 +99,11 @@ public class TrackedRaceWithContext implements HasTrackedRaceContext {
return startLine.getAdvantageousSideWhileApproachingLine();
}
@Override
public Boolean isMedalRace() {
return getLeaderboardContext().getLeaderboard().getRaceColumnAndFleet(getTrackedRace()).getA().isMedalRace();
}
@Override
public Boolean isTracked() {
return getTrackedRace().hasStarted(MillisecondsTimePoint.now());
@@ -235,7 +235,7 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
// neither do we know about the end time if both, startOfTracking and endOfTracking are null
// and we have neither a valid newestTrackingEvent nor an endOfRace value; if we do, we would
// have to be before the later one plus some leeway.
final Date endTimeOfLivePeriod;
Date endTimeOfLivePeriod;
if (lastRaceTimesInfo.startOfTracking == null && lastRaceTimesInfo.endOfTracking == null) {
Date latestOfNewestTrackingEventAndEndOfRace = lastRaceTimesInfo.newestTrackingEvent;
if (latestOfNewestTrackingEventAndEndOfRace == null || (lastRaceTimesInfo.endOfRace != null && lastRaceTimesInfo.endOfRace.after(latestOfNewestTrackingEventAndEndOfRace))) {
@@ -245,6 +245,14 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
new Date(latestOfNewestTrackingEventAndEndOfRace.getTime() + RaceTimesCalculationUtil.TIME_AFTER_LIVE);
} else {
endTimeOfLivePeriod = lastRaceTimesInfo.endOfTracking == null ? null : lastRaceTimesInfo.endOfTracking;
if (lastRaceTimesInfo.endOfRace != null) {
// this is a failsafe, if the tracking was never finsihed, the race was always assumed to be live.
Date latestAllowedTime = new Date(
lastRaceTimesInfo.endOfRace.getTime() + RaceTimesCalculationUtil.MAX_TIME_AFTER_RACE_END);
if (endTimeOfLivePeriod == null || endTimeOfLivePeriod.after(latestAllowedTime)) {
endTimeOfLivePeriod = latestAllowedTime;
}
}
}
isLiveModeToBeMadePossible = endTimeOfLivePeriod == null /* meaning we don't know an end time */ ||
endTimeOfLivePeriod.getTime() >= liveTimePointInMillis;