mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
bug6048: implemented new statistic for duration since start to first tack
This commit is contained in:
+2
-1
@@ -272,4 +272,5 @@ CompetitorSailingDomainRetrieverChain=Competitors in Leaderboards
|
||||
SmoothedSpeed=Smoothed Speed
|
||||
RatioDistanceLongVsShortTack=Ratio distance long tack / short tack
|
||||
RatioDurationLongVsShortTack=Ratio duration long tack / short tack
|
||||
Discarded=Discarded
|
||||
Discarded=Discarded
|
||||
DurationFromRaceStartToFirstTack=Duration from race start to first tack
|
||||
+2
-1
@@ -270,4 +270,5 @@ CompetitorSailingDomainRetrieverChain=Teilnehmer in Ranglisten
|
||||
SmoothedSpeed=Geglättete Geschwindigkeit
|
||||
RatioDistanceLongVsShortTack=Verhältnis gesegelte Distanz auf Streck- zu Holebug
|
||||
RatioDurationLongVsShortTack=Verhältnis gesegelte Dauer auf Streck- zu Holebug
|
||||
Discarded=Gestrichen
|
||||
Discarded=Gestrichen
|
||||
DurationFromRaceStartToFirstTack=Dauer vom Start der Wettfahrt bis zur ersten Wende
|
||||
+7
@@ -143,6 +143,13 @@ public interface HasRaceOfCompetitorContext {
|
||||
@Statistic(messageKey="RaceDuration")
|
||||
Duration getDuration();
|
||||
|
||||
/**
|
||||
* The time between the start of the race and the {@link #getCompetitor() competitor}'s first tack;
|
||||
* {@code null} if no tack is found for the competitor in the race.
|
||||
*/
|
||||
@Statistic(messageKey="DurationFromRaceStartToFirstTack")
|
||||
Duration getDurationFromStartToFirstTack();
|
||||
|
||||
@Statistic(messageKey="DistanceToStarboardSideAtStartOfRace", resultDecimals=2)
|
||||
public Double getRelativeDistanceToStarboardSideAtStartOfRace();
|
||||
|
||||
|
||||
+21
@@ -36,6 +36,7 @@ import com.sap.sailing.domain.tracking.TrackedLeg;
|
||||
import com.sap.sailing.domain.tracking.TrackedLegOfCompetitor;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.WindPositionMode;
|
||||
import com.sap.sailing.domain.tracking.impl.TimedComparator;
|
||||
import com.sap.sse.common.Bearing;
|
||||
import com.sap.sse.common.Distance;
|
||||
import com.sap.sse.common.Duration;
|
||||
@@ -399,6 +400,26 @@ public class RaceOfCompetitorWithContext implements HasRaceOfCompetitorContext {
|
||||
return duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getDurationFromStartToFirstTack() {
|
||||
final TrackedRace race = getTrackedRace();
|
||||
final Duration result;
|
||||
if (race.getStartOfRace() == null) {
|
||||
result = null;
|
||||
} else {
|
||||
final Iterable<Maneuver> maneuvers = race.getManeuvers(competitor, /* wait for latest */ false);
|
||||
final List<Maneuver> tacks = Util.asList(Util.filter(maneuvers,
|
||||
m->m.getType() == ManeuverType.TACK && !m.getTimePoint().before(race.getStartOfRace())));
|
||||
if (tacks.isEmpty()) {
|
||||
result = null;
|
||||
} else {
|
||||
tacks.sort(TimedComparator.INSTANCE);
|
||||
result = race.getStartOfRace().until(tacks.get(0).getTimePoint());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getRelativeDistanceToStarboardSideAtStartOfRace() {
|
||||
TrackedRace trackedRace = getTrackedRace();
|
||||
|
||||
Reference in New Issue
Block a user