Merge branch 'master' into bug5477

This commit is contained in:
Axel Uhl committed 2021-01-13 14:18:27 +01:00
commit 9ec92d3de2
2 files changed
+14 -1

No files matched your search

@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.logging.Logger;
import java.util.stream.StreamSupport;
import com.sap.sailing.domain.abstractlog.impl.LogEventAuthorImpl;
@@ -60,6 +61,7 @@ import com.tractrac.model.lib.api.event.RaceStatusType;
*
*/
public class RaceAndCompetitorStatusWithRaceLogReconciler {
private static final Logger logger = Logger.getLogger(RaceAndCompetitorStatusWithRaceLogReconciler.class.getName());
private final DomainFactory domainFactory;
private final RaceLogResolver raceLogResolver;
private final LogEventAuthorImpl raceLogEventAuthor;
@@ -342,6 +344,8 @@ public class RaceAndCompetitorStatusWithRaceLogReconciler {
final int officialRank = raceCompetitor.getOfficialRank();
final long officialFinishingTime = raceCompetitor.getOfficialFinishTime();
final long timePointForStatusEvent = raceCompetitor.getStatusTime();
logger.info("Received a status change for competitor " + raceCompetitor + " in race "+trackedRace.getRaceIdentifier()+": officialRank: " + officialRank
+ ", officialFinishingTime: " + officialFinishingTime + ", statusTime: " + timePointForStatusEvent);
if (timePointForStatusEvent != 0) {
// there is an official result for the competitor on TracTrac's side
// find out if we already have this information represented in the race log(s) and if not if the TracTrac information is newer:
@@ -374,7 +378,16 @@ public class RaceAndCompetitorStatusWithRaceLogReconciler {
defaultRaceLog.add(new RaceLogFinishPositioningConfirmedEventImpl(officialResultTime, officialResultTime,
new LogEventAuthorImpl("Official TracTrac Result Provider", 1), // equally important as race officer on water
UUID.randomUUID(), defaultRaceLog.getCurrentPassId(), resultsForRaceLog));
logger.info("Added the following result to the race log of " + trackedRace.getRaceIdentifier()
+ " for competitor " + raceCompetitor + ": " + resultForRaceLog);
} else {
logger.info("Did not produce a new competitor result for competitor " + raceCompetitor + " in race "
+ trackedRace.getRaceIdentifier() + " because existing result "
+ resultFromRaceLogAndItsCreationTimePoint + " was not older than status time "
+ officialResultTime + " or was an equal result");
}
} else {
logger.info("Ignoring status change for competitor " + raceCompetitor + " in race "+trackedRace.getRaceIdentifier()+" because the status time was 0");
}
}
@@ -317,7 +317,7 @@ implements com.sap.sailing.domain.orc.ORCPerformanceCurveRankingMetric {
Duration minGPH = new MillisecondsDurationImpl(Long.MAX_VALUE);
Boat boatWithMinGPH = null;
for (final Entry<Boat, ORCCertificate> e : certificates.entrySet()) {
if (e.getValue().getGPH().compareTo(minGPH) < 0) {
if (e.getValue().getGPH() != null && e.getValue().getGPH().compareTo(minGPH) < 0) {
boatWithMinGPH = e.getKey();
minGPH = e.getValue().getGPH();
}