mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
Merge branch 'racecommittee_integrated' of ssh://10.18.22.156:12349/home/trac/git into racecommittee_integrated
This commit is contained in:
commit
28b2d74e92
7 files changed
+126
-13
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
package com.sap.sailing.domain.racelog.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.analyzing.impl.LastFlagFinder;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogImpl;
|
||||
|
||||
public class RaceLogAnalyzerTest {
|
||||
|
||||
@Test
|
||||
public void testLastFlagFinder() {
|
||||
RaceLog raceLog = new RaceLogImpl("RaceLogTest");
|
||||
TimePoint t1 = MillisecondsTimePoint.now();
|
||||
int passId = 0;
|
||||
boolean isDisplayed = true;
|
||||
RaceLogFlagEvent rcEvent = RaceLogEventFactory.INSTANCE.createFlagEvent(t1, passId, Flags.XRAY, Flags.NONE,
|
||||
isDisplayed);
|
||||
raceLog.add(rcEvent);
|
||||
rcEvent = RaceLogEventFactory.INSTANCE.createFlagEvent(t1.plus(1), passId, Flags.PAPA, Flags.NONE,
|
||||
isDisplayed);
|
||||
raceLog.add(rcEvent);
|
||||
|
||||
raceLog.lockForRead();
|
||||
try {
|
||||
LastFlagFinder lff = new LastFlagFinder(raceLog);
|
||||
assertEquals(rcEvent, lff.getLastFlagEvent());
|
||||
|
||||
} finally {
|
||||
raceLog.unlockAfterRead();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.sap.sailing.domain.racelog.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
|
||||
public class LastFlagFinder extends RaceLogAnalyzer {
|
||||
|
||||
public LastFlagFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
public RaceLogFlagEvent getLastFlagEvent() {
|
||||
RaceLogFlagEvent lastFlagEvent = null;
|
||||
|
||||
this.raceLog.lockForRead();
|
||||
try {
|
||||
lastFlagEvent = searchForLastFlagEvent();
|
||||
} finally {
|
||||
this.raceLog.unlockAfterRead();
|
||||
}
|
||||
|
||||
return lastFlagEvent;
|
||||
}
|
||||
|
||||
private RaceLogFlagEvent searchForLastFlagEvent() {
|
||||
RaceLogFlagEvent lastFlagEvent = null;
|
||||
|
||||
for (RaceLogEvent event : getPassEvents()) {
|
||||
if (event instanceof RaceLogFlagEvent) {
|
||||
lastFlagEvent = (RaceLogFlagEvent) event;
|
||||
}
|
||||
}
|
||||
|
||||
return lastFlagEvent;
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -536,4 +536,5 @@ public interface StringMessages extends Messages {
|
||||
String tractracUsername();
|
||||
String tractracPassword();
|
||||
String flagStatus();
|
||||
String additionalInformation();
|
||||
}
|
||||
+4
-3
@@ -512,7 +512,7 @@ angleAndTotalNumberOfDataPoints=Angle: {0}; Total number of data-points: {1}
|
||||
buoyZone=Buoy zone
|
||||
radiusInMeters=Radius (m)
|
||||
filterRegattasByName=Filter regattas by name
|
||||
noRegattasYet=There are no regattas yet.
|
||||
noRegattasYet=There are no regattas yet.
|
||||
addCourseArea=Add course area
|
||||
courseAreas=Course areas
|
||||
courseArea=Course area
|
||||
@@ -529,7 +529,7 @@ penaltyOrRedress=Penalty/Redress
|
||||
netScore=Net points
|
||||
timePointMustBeAfterStartOfTracking=Time point must be after start of tracking.
|
||||
timePointMustBeBeforeEndOfTracking=Time point must be before end of tracking.
|
||||
regattaUsedForTheTrackedRace=Regatta used for the tracked race
|
||||
regattaUsedForTheTrackedRace=Regatta used for the tracked race
|
||||
courseDesignUpdateUrl=Course design update URI
|
||||
passingSide=Passing side
|
||||
refreshNow=Refresh now
|
||||
@@ -538,4 +538,5 @@ startUpdating=Start updating
|
||||
currentTime=Current time:
|
||||
tractracUsername=TracTrac username
|
||||
tractracPassword=TracTrac password
|
||||
flagStatus=Flag status
|
||||
flagStatus=Flag status
|
||||
additionalInformation=Additional information
|
||||
+19
@@ -275,6 +275,24 @@ public class RegattaOverviewTableComposite extends Composite {
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<RegattaOverviewEntryDTO> raceAddditionalInformationColumn = new TextColumn<RegattaOverviewEntryDTO>() {
|
||||
@Override
|
||||
public String getValue(RegattaOverviewEntryDTO entryDTO) {
|
||||
StringBuffer additionalInformation = new StringBuffer();
|
||||
if(entryDTO.raceInfo.pathfinderId!=null){
|
||||
additionalInformation.append("Pathfinder: "+entryDTO.raceInfo.pathfinderId);
|
||||
}
|
||||
if(entryDTO.raceInfo.pathfinderId!=null && entryDTO.raceInfo.gateLineOpeningTime!=null){
|
||||
additionalInformation.append(" / ");
|
||||
}
|
||||
if(entryDTO.raceInfo.gateLineOpeningTime!=null){
|
||||
additionalInformation.append("GateLineOpeningTime: "+(entryDTO.raceInfo.gateLineOpeningTime/(60*1000))+" minutes");
|
||||
}
|
||||
|
||||
return additionalInformation.toString();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
table.addColumn(courseAreaColumn, stringMessages.courseArea());
|
||||
table.addColumn(regattaNameColumn, stringMessages.boatClass()); // For sailors the boat class also contains additional infos such as woman/man, e.g. Laser Radial Woman or Laser Radial Men
|
||||
@@ -285,6 +303,7 @@ public class RegattaOverviewTableComposite extends Composite {
|
||||
table.addColumn(lastUpperFlagColumn, stringMessages.lastUpperFlag());
|
||||
table.addColumn(lastLowerFlagColumn, stringMessages.lastLowerFlag());
|
||||
table.addColumn(lastFlagDirectionColumn, stringMessages.flagStatus());
|
||||
table.addColumn(raceAddditionalInformationColumn, stringMessages.additionalInformation());
|
||||
table.addColumnSortHandler(regattaOverviewListHandler);
|
||||
|
||||
return table;
|
||||
|
||||
+21
-8
@@ -125,9 +125,11 @@ import com.sap.sailing.domain.persistence.MongoWindStoreFactory;
|
||||
import com.sap.sailing.domain.polarsheets.BoatAndWindSpeed;
|
||||
import com.sap.sailing.domain.polarsheets.PolarSheetGenerationWorker;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.analyzing.impl.GateLineOpeningTimeFinder;
|
||||
import com.sap.sailing.domain.racelog.analyzing.impl.LastFlagFinder;
|
||||
import com.sap.sailing.domain.racelog.analyzing.impl.LastPublishedCourseDesignFinder;
|
||||
import com.sap.sailing.domain.racelog.analyzing.impl.PathfinderFinder;
|
||||
import com.sap.sailing.domain.racelog.analyzing.impl.RaceStatusAnalyzer;
|
||||
import com.sap.sailing.domain.racelog.analyzing.impl.StartTimeFinder;
|
||||
import com.sap.sailing.domain.racelog.impl.PassAwareRaceLogImpl;
|
||||
@@ -1106,20 +1108,31 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
RaceInfoDTO raceInfoDTO = new RaceInfoDTO();
|
||||
RaceLog raceLog = raceColumn.getRaceLog(fleet);
|
||||
if (raceLog != null) {
|
||||
|
||||
PassAwareRaceLogImpl passAwareRaceLog = new PassAwareRaceLogImpl(raceLog);
|
||||
StartTimeFinder startTimeFinder = new StartTimeFinder(passAwareRaceLog);
|
||||
if (startTimeFinder.getStartTime() != null) {
|
||||
if(startTimeFinder.getStartTime()!=null){
|
||||
raceInfoDTO.startTime = startTimeFinder.getStartTime().asDate();
|
||||
}
|
||||
|
||||
RaceStatusAnalyzer raceStatusAnalyzer = new RaceStatusAnalyzer(passAwareRaceLog);
|
||||
raceInfoDTO.lastStatus = raceStatusAnalyzer.getStatus();
|
||||
for(RaceLogEvent event : passAwareRaceLog.getFixes()){
|
||||
if(event instanceof RaceLogFlagEvent){
|
||||
raceInfoDTO.lastUpperFlag = ((RaceLogFlagEvent) event).getUpperFlag();
|
||||
raceInfoDTO.lastLowerFlag = ((RaceLogFlagEvent) event).getLowerFlag();
|
||||
raceInfoDTO.displayed = ((RaceLogFlagEvent) event).isDisplayed();
|
||||
}
|
||||
|
||||
PathfinderFinder pathfinderFinder = new PathfinderFinder(passAwareRaceLog);
|
||||
raceInfoDTO.pathfinderId = pathfinderFinder.getPathfinderId();
|
||||
|
||||
GateLineOpeningTimeFinder gateLineOpeningTimeFinder = new GateLineOpeningTimeFinder(passAwareRaceLog);
|
||||
raceInfoDTO.gateLineOpeningTime = gateLineOpeningTimeFinder.getGateLineOpeningTime();
|
||||
|
||||
LastFlagFinder lastFlagFinder = new LastFlagFinder(passAwareRaceLog);
|
||||
|
||||
RaceLogFlagEvent lastFlagEvent = lastFlagFinder.getLastFlagEvent();
|
||||
if (lastFlagEvent != null) {
|
||||
raceInfoDTO.lastUpperFlag = lastFlagEvent.getUpperFlag();
|
||||
raceInfoDTO.lastLowerFlag = lastFlagEvent.getLowerFlag();
|
||||
raceInfoDTO.displayed = lastFlagEvent.isDisplayed();
|
||||
}
|
||||
|
||||
LastPublishedCourseDesignFinder courseDesignFinder = new LastPublishedCourseDesignFinder(raceLog);
|
||||
raceInfoDTO.lastCourseDesign = convertCourseDesignToRaceCourseDTO(courseDesignFinder.getLastCourseDesign());
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ public class RaceInfoDTO implements IsSerializable {
|
||||
public boolean displayed;
|
||||
public RaceCourseDTO lastCourseDesign;
|
||||
public RaceIdentifier raceIdentifier;
|
||||
public String additionalInformation;
|
||||
|
||||
public String pathfinderId;
|
||||
public Long gateLineOpeningTime;
|
||||
// for GWT serialization
|
||||
public RaceInfoDTO() { }
|
||||
|
||||
|
||||
Reference in new issue
Block a user