mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-28 00:16:46 +00:00
Merge branch 'master' into spectator
This commit is contained in:
+3
-1
@@ -380,7 +380,9 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
|
||||
MarkPassing firstMarkPassing = null;
|
||||
synchronized (markPassingsInOrder) {
|
||||
Iterator<MarkPassing> markPassingsForLegEnd = markPassingsInOrder.iterator();
|
||||
firstMarkPassing = markPassingsForLegEnd.next();
|
||||
if (markPassingsForLegEnd.hasNext()) {
|
||||
firstMarkPassing = markPassingsForLegEnd.next();
|
||||
}
|
||||
}
|
||||
if (firstMarkPassing != null) {
|
||||
// someone has already finished the leg
|
||||
|
||||
+8
-6
@@ -1134,12 +1134,14 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
try {
|
||||
// Get distance to nearest placemark and calculate the search radius
|
||||
Placemark startNearest = ReverseGeocoder.INSTANCE.getPlacemarkNearest(startPosition);
|
||||
Distance startNearestDistance = startNearest.distanceFrom(startPosition);
|
||||
double startRadius = startNearestDistance.getKilometers() * GEONAMES_RADIUS_CACLCULATION_FACTOR;
|
||||
if (startNearest != null) {
|
||||
Distance startNearestDistance = startNearest.distanceFrom(startPosition);
|
||||
double startRadius = startNearestDistance.getKilometers() * GEONAMES_RADIUS_CACLCULATION_FACTOR;
|
||||
|
||||
// Get the estimated best start place
|
||||
startBest = ReverseGeocoder.INSTANCE.getPlacemarkLast(startPosition, startRadius,
|
||||
new Placemark.ByPopulationDistanceRatio(startPosition));
|
||||
// Get the estimated best start place
|
||||
startBest = ReverseGeocoder.INSTANCE.getPlacemarkLast(startPosition, startRadius,
|
||||
new Placemark.ByPopulationDistanceRatio(startPosition));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||
} catch (ParseException e) {
|
||||
@@ -1169,7 +1171,7 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
logger.throwing(TrackedRaceImpl.class.getName(), "getPlaceOrder()", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (startBest != null) {
|
||||
placemarks.setA(startBest);
|
||||
}
|
||||
|
||||
+13
-12
@@ -53,7 +53,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
|
||||
p = cachedPlacemarks.getC().get(0);
|
||||
} else {
|
||||
JSONArray geonames = callNearestService(position);
|
||||
if (!geonames.isEmpty()) {
|
||||
if (geonames != null && !geonames.isEmpty()) {
|
||||
p = JSONToPlacemark((JSONObject) geonames.get(0));
|
||||
|
||||
if (p != null) {
|
||||
@@ -97,16 +97,17 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
|
||||
}
|
||||
|
||||
JSONArray geonames = callNearbyService(searchPosition, limitedRadius, maxRows);
|
||||
Iterator<Object> iterator = geonames.iterator();
|
||||
placemarks = !geonames.isEmpty() ? new ArrayList<Placemark>() : null;
|
||||
while (iterator.hasNext()) {
|
||||
JSONObject object = (JSONObject) iterator.next();
|
||||
Placemark place = JSONToPlacemark(object);
|
||||
if (place != null) {
|
||||
placemarks.add(JSONToPlacemark(object));
|
||||
if (geonames != null) {
|
||||
Iterator<Object> iterator = geonames.iterator();
|
||||
placemarks = iterator.hasNext() ? new ArrayList<Placemark>() : null;
|
||||
while (iterator.hasNext()) {
|
||||
JSONObject object = (JSONObject) iterator.next();
|
||||
Placemark place = JSONToPlacemark(object);
|
||||
if (place != null) {
|
||||
placemarks.add(JSONToPlacemark(object));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there are no cached placemarks for the requested Position just cache them, otherwise update the cache
|
||||
if (cachedPlacemarks == null && placemarks != null) {
|
||||
cachePlacemarks(searchPosition, limitedRadius, placemarks);
|
||||
@@ -191,8 +192,8 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
|
||||
* The results of the search
|
||||
*/
|
||||
private void cachePlacemarks(Position position, Double radius, List<Placemark> placemarks) {
|
||||
// Collections.sort(placemarks, new Placemark.ByDistance(position));
|
||||
// cache.put(position, new Triple<Position, Double, List<Placemark>>(position, radius, placemarks));
|
||||
Collections.sort(placemarks, new Placemark.ByDistance(position));
|
||||
cache.put(position, new Triple<Position, Double, List<Placemark>>(position, radius, placemarks));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +201,7 @@ public class ReverseGeocoderImpl implements ReverseGeocoder {
|
||||
*
|
||||
* @param cachedPoint
|
||||
* The position of the data which should be replaced. Has to be a Position which was cached before.<br />
|
||||
* The paramater is as best a value from a Triple in the cache, like <code>cachedData.getA()</code>.
|
||||
* The parameter is as best a value from a Triple in the cache, like <code>cachedData.getA()</code>.
|
||||
* @param newRadius
|
||||
* The new radius of the cached search results
|
||||
* @param newPlacemarks
|
||||
|
||||
+6
-5
@@ -303,8 +303,8 @@ public class WindChart implements Component<WindChartSettings>, RaceSelectionCha
|
||||
selectedRaceIdentifier = selectedRaces.iterator().next();
|
||||
timeOfEarliestRequestInMillis = null;
|
||||
timeOfLatestRequestInMillis = null;
|
||||
// TODO bug #363: if race is not in replay mode, fetch only up to now-delay
|
||||
loadData(selectedRaceIdentifier, /* from */ null, /* to */ null, /* append */ false);
|
||||
loadData(selectedRaceIdentifier, /* from */null, /* to */
|
||||
new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()), /* append */false);
|
||||
} else {
|
||||
clearChart();
|
||||
}
|
||||
@@ -322,14 +322,15 @@ public class WindChart implements Component<WindChartSettings>, RaceSelectionCha
|
||||
if (timeOfEarliestRequestInMillis == null || timeOfEarliestRequestInMillis > date.getTime()) {
|
||||
loadData(selectedRaceIdentifier, null, date, /* append */ true);
|
||||
} else if (timeOfLatestRequestInMillis < date.getTime()) {
|
||||
// TODO bug #363: if race is not in replay mode, fetch only up to now-delay
|
||||
loadData(selectedRaceIdentifier, new Date(timeOfLatestRequestInMillis), /* to */ null, /* append */ true);
|
||||
loadData(selectedRaceIdentifier, new Date(timeOfLatestRequestInMillis), /* to */
|
||||
new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()), /* append */true);
|
||||
}
|
||||
// otherwise the cache spans across date and so we don't need to load anything
|
||||
} else {
|
||||
// assuming play mode is replay / non-live
|
||||
if (timeOfLatestRequestInMillis == null) {
|
||||
loadData(selectedRaceIdentifier, /* from */ null, /* to */ null, /* append */ false); // replace old series
|
||||
loadData(selectedRaceIdentifier, /* from */null, /* to */
|
||||
new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()), /* append */false); // replace old series
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -139,11 +139,6 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
String[] getCountryCodes();
|
||||
|
||||
// CompetitorInRaceDTO getCompetitorRaceData(RaceIdentifier race,
|
||||
// CompetitorsAndTimePointsDTO competitorsAndTimePointsDTO, DetailType dataType) throws NoWindException;
|
||||
|
||||
// CompetitorsAndTimePointsDTO getCompetitorsAndTimePoints(RaceIdentifier race, long stepSize);
|
||||
|
||||
Map<CompetitorDTO, List<GPSFixDTO>> getDouglasPoints(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to, double meters) throws NoWindException;
|
||||
|
||||
@@ -164,6 +159,7 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
void updateLeaderboardGroup(String oldName, String newName, String description, List<LeaderboardDTO> leaderboards);
|
||||
|
||||
MultiCompetitorRaceDataDTO getCompetitorsRaceData(RaceIdentifier race, List<Pair<Date, CompetitorDTO>> competitors, long stepSize, DetailType detailType)
|
||||
MultiCompetitorRaceDataDTO getCompetitorsRaceData(RaceIdentifier race, List<Pair<Date, CompetitorDTO>> competitors,
|
||||
Date toDate, long stepSize, DetailType detailType)
|
||||
throws NoWindException;
|
||||
}
|
||||
|
||||
+1
-1
@@ -283,6 +283,6 @@ public interface SailingServiceAsync {
|
||||
* returned.<br />
|
||||
* Returns <code>null</code>, if <code>race</code> isn't tracked.
|
||||
*/
|
||||
void getCompetitorsRaceData(RaceIdentifier race, List<Pair<Date,CompetitorDTO>> competitorsToLoad, long stepSize,
|
||||
void getCompetitorsRaceData(RaceIdentifier race, List<Pair<Date,CompetitorDTO>> competitorsToLoad, Date toDate, long stepSize,
|
||||
DetailType detailType, AsyncCallback<MultiCompetitorRaceDataDTO> callback);
|
||||
}
|
||||
|
||||
+24
-15
@@ -192,19 +192,20 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
chartData = new MultiCompetitorRaceDataDTO(getDataToShow());
|
||||
}
|
||||
|
||||
final ArrayList<Pair<Date, CompetitorDTO>> competitorsToLoad = new ArrayList<Pair<Date, CompetitorDTO>>();
|
||||
Date toDate = new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis());
|
||||
final ArrayList<Pair<Date, CompetitorDTO>> dataQuery = new ArrayList<Pair<Date, CompetitorDTO>>();
|
||||
for (CompetitorDTO competitor : getVisibleCompetitors()) {
|
||||
Date chartDataDateOfNewestData = chartData.getDateOfNewestData();
|
||||
Date competitorDateOfNewestData = chartData.contains(competitor) ? chartData.getCompetitorData(competitor).getDateOfNewestData() : null;
|
||||
if (!chartData.contains(competitor)) {
|
||||
competitorsToLoad.add(new Pair<Date, CompetitorDTO>(new Date(0), competitor));
|
||||
} else if (chartData.getCompetitorData(competitor).getDateOfNewestData().before(chartDataDateOfNewestData)) {
|
||||
Date competitorDateOfNewestData = chartData.getCompetitorData(competitor).getDateOfNewestData();
|
||||
competitorsToLoad.add(new Pair<Date, CompetitorDTO>(new Date(competitorDateOfNewestData.getTime() + getStepSize()), competitor));
|
||||
dataQuery.add(new Pair<Date, CompetitorDTO>(new Date(0), competitor));
|
||||
} else if (competitorDateOfNewestData.before(chartDataDateOfNewestData) || competitorDateOfNewestData.before(toDate)) {
|
||||
dataQuery.add(new Pair<Date, CompetitorDTO>(new Date(competitorDateOfNewestData.getTime() + getStepSize()), competitor));
|
||||
}
|
||||
}
|
||||
|
||||
sailingService.getCompetitorsRaceData(getSelectedRace(), competitorsToLoad, getStepSize(),
|
||||
getDataToShow(), new AsyncCallback<MultiCompetitorRaceDataDTO>() {
|
||||
sailingService.getCompetitorsRaceData(getSelectedRace(), dataQuery, toDate, getStepSize(), getDataToShow(),
|
||||
new AsyncCallback<MultiCompetitorRaceDataDTO>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
@@ -281,25 +282,33 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
if (isCompetitorVisible(competitor)) {
|
||||
CompetitorRaceDataDTO competitorData = chartData.getCompetitorData(competitor);
|
||||
if (competitorData != null) {
|
||||
Date toDate = new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis());
|
||||
|
||||
List<Triple<String, Date, Double>> markPassingsData = competitorData.getMarkPassingsData();
|
||||
List<Point> markPassingPoints = new ArrayList<Point>();
|
||||
for (Triple<String, Date, Double> markPassingData : markPassingsData) {
|
||||
if (markPassingData.getB() != null && markPassingData.getC() != null) {
|
||||
Point markPassingPoint = new Point(markPassingData.getB().getTime(), markPassingData.getC());
|
||||
markPassingPoint.setName(markPassingData.getA());
|
||||
markPassingPoints.add(markPassingPoint);
|
||||
if (markPassingData.getB().before(toDate)) {
|
||||
Point markPassingPoint = new Point(markPassingData.getB().getTime(),
|
||||
markPassingData.getC());
|
||||
markPassingPoint.setName(markPassingData.getA());
|
||||
markPassingPoints.add(markPassingPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
markSeries.setPoints(markPassingPoints.toArray(new Point[0]));
|
||||
|
||||
Point[] compSeriesPoints = compSeries.getPoints();
|
||||
Date dateOfNewestSeriesPoint = compSeriesPoints.length == 0 ? new Date(0) : new Date(
|
||||
compSeriesPoints[compSeriesPoints.length - 1].getX().longValue());
|
||||
List<Pair<Date, Double>> raceData = competitorData.getRaceDataAfterDate(dateOfNewestSeriesPoint);
|
||||
Date dateOfNewestSeriesPoint = compSeriesPoints.length == 0 ? null :
|
||||
new Date(compSeriesPoints[compSeriesPoints.length - 1].getX().longValue());
|
||||
List<Pair<Date, Double>> raceData = dateOfNewestSeriesPoint == null ? competitorData
|
||||
.getRaceData() : competitorData.getRaceDataAfterDate(dateOfNewestSeriesPoint);
|
||||
for (Pair<Date, Double> data : raceData) {
|
||||
if (data.getA() != null && data.getB() != null) {
|
||||
Point competitorPoint = new Point(data.getA().getTime(), data.getB());
|
||||
compSeries.addPoint(competitorPoint);
|
||||
if (data.getA().before(toDate)) {
|
||||
Point competitorPoint = new Point(data.getA().getTime(), data.getB());
|
||||
compSeries.addPoint(competitorPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class RaceBoardEntryPoint extends AbstractEntryPoint {
|
||||
String viewModeParamValue = Window.Location.getParameter("viewMode");
|
||||
try {
|
||||
viewMode = RaceBoardViewMode.valueOf(RaceBoardViewMode.class, viewModeParamValue);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (Exception e) {
|
||||
viewMode = RaceBoardViewMode.ONE_SCREEN;
|
||||
}
|
||||
eventName = Window.Location.getParameter("eventName");
|
||||
|
||||
+33
-47
@@ -198,31 +198,11 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
result.competitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
for (RaceInLeaderboard raceColumn : leaderboard.getRaceColumns()) {
|
||||
RaceIdentifier raceIdentifier = null;
|
||||
StrippedRaceDTO race = null;
|
||||
if(raceColumn.getTrackedRace() != null) {
|
||||
TrackedRace trackedRace = raceColumn.getTrackedRace();
|
||||
raceIdentifier = new EventNameAndRaceName(trackedRace.getTrackedEvent().getEvent().getName(), trackedRace.getRace().getName());
|
||||
|
||||
//Getting the places of the race
|
||||
Pair<Placemark, Placemark> startAndFinish = trackedRace.getStartFinishPlacemarks();
|
||||
PlacemarkOrderDTO racePlaces = new PlacemarkOrderDTO();
|
||||
if (startAndFinish.getA() != null) {
|
||||
racePlaces.getPlacemarks().add(convertToPlacemarkDTO(startAndFinish.getA()));
|
||||
}
|
||||
if (startAndFinish.getB() != null) {
|
||||
racePlaces.getPlacemarks().add(convertToPlacemarkDTO(startAndFinish.getB()));
|
||||
}
|
||||
if (racePlaces.isEmpty()) {
|
||||
racePlaces = null;
|
||||
}
|
||||
|
||||
//Creating raceDTO and getting the dates
|
||||
StrippedRaceDTO raceDTO = new StrippedRaceDTO(trackedRace.getRace().getName(), raceIdentifier, racePlaces);
|
||||
raceDTO.startOfTracking = trackedRace.getStartOfTracking().asDate();
|
||||
raceDTO.startOfRace = trackedRace.getStart().asDate();
|
||||
raceDTO.endOfRace = trackedRace.getAssumedEnd() == null ? null : trackedRace.getAssumedEnd().asDate();
|
||||
}
|
||||
result.addRace(raceColumn.getName(), raceColumn.isMedalRace(), raceIdentifier, race);
|
||||
result.addRace(raceColumn.getName(), raceColumn.isMedalRace(), raceIdentifier, null);
|
||||
}
|
||||
result.rows = new HashMap<CompetitorDTO, LeaderboardRowDTO>();
|
||||
result.hasCarriedPoints = leaderboard.hasCarriedPoints();
|
||||
@@ -557,7 +537,8 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
result.raceIsKnownToStartUpwind = trackedRace.raceIsKnownToStartUpwind();
|
||||
result.selectedWindSource = trackedRace.getWindSource();
|
||||
TimePoint from = fromDate == null ? trackedRace.getStart() : new MillisecondsTimePoint(fromDate);
|
||||
TimePoint to = toDate == null ? trackedRace.getTimePointOfNewestEvent() : new MillisecondsTimePoint(toDate);
|
||||
TimePoint newestEvent = trackedRace.getTimePointOfNewestEvent();
|
||||
TimePoint to = (toDate == null || toDate.after(newestEvent.asDate())) ? newestEvent : new MillisecondsTimePoint(toDate);
|
||||
Map<WindSource, WindTrackInfoDTO> windTrackInfoDTOs = new HashMap<WindSource, WindTrackInfoDTO>();
|
||||
result.windTrackInfoByWindSource = windTrackInfoDTOs;
|
||||
if (from != null && to != null) {
|
||||
@@ -956,7 +937,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
|
||||
@Override
|
||||
public LeaderboardDTO createLeaderboard(String leaderboardName, int[] discardThresholds) {
|
||||
return createStrippedLeaderboardDTO(getService().addLeaderboard(leaderboardName, discardThresholds));
|
||||
return createStrippedLeaderboardDTO(getService().addLeaderboard(leaderboardName, discardThresholds), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -964,7 +945,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
Map<String, Leaderboard> leaderboards = getService().getLeaderboards();
|
||||
List<LeaderboardDTO> results = new ArrayList<LeaderboardDTO>();
|
||||
for(Leaderboard leaderboard: leaderboards.values()) {
|
||||
LeaderboardDTO dao = createStrippedLeaderboardDTO(leaderboard);
|
||||
LeaderboardDTO dao = createStrippedLeaderboardDTO(leaderboard, false);
|
||||
results.add(dao);
|
||||
}
|
||||
|
||||
@@ -1000,7 +981,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
TrackedRace trackedRace = raceInLeaderboard.getTrackedRace();
|
||||
RaceDefinition trackedRaceDef = trackedRace != null ? trackedRace.getRace() : null;
|
||||
if (trackedRaceDef != null && trackedRaceDef.getName().equals(race.name)) {
|
||||
results.add(createStrippedLeaderboardDTO(leaderboard));
|
||||
results.add(createStrippedLeaderboardDTO(leaderboard, false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1013,9 +994,10 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
* in the form of {@link RaceInLeaderboardDTO}s, whether or not there are {@link LeaderboardDTO#hasCarriedPoints carried points}
|
||||
* and the {@link LeaderboardDTO#discardThresholds discarding thresholds} for the leaderboard. No data about the points
|
||||
* is filled into the result object. No data about the competitor display names is filled in; instead, an empty map
|
||||
* is used for {@link LeaderboardDTO#competitorDisplayNames}.
|
||||
* is used for {@link LeaderboardDTO#competitorDisplayNames}.<br />
|
||||
* If <code>withAdditionalData</code> is <code>true</code>, additional data (like location and race dates) will be loaded.
|
||||
*/
|
||||
private LeaderboardDTO createStrippedLeaderboardDTO(Leaderboard leaderboard) {
|
||||
private LeaderboardDTO createStrippedLeaderboardDTO(Leaderboard leaderboard, boolean withAdditionalData) {
|
||||
LeaderboardDTO dto = new LeaderboardDTO();
|
||||
dto.name = leaderboard.getName();
|
||||
dto.competitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
@@ -1026,24 +1008,26 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
TrackedRace trackedRace = raceColumn.getTrackedRace();
|
||||
raceIdentifier = new EventNameAndRaceName(trackedRace.getTrackedEvent().getEvent().getName(), trackedRace.getRace().getName());
|
||||
|
||||
//Getting the places of the race
|
||||
Pair<Placemark, Placemark> startAndFinish = trackedRace.getStartFinishPlacemarks();
|
||||
PlacemarkOrderDTO racePlaces = new PlacemarkOrderDTO();
|
||||
if (startAndFinish.getA() != null) {
|
||||
racePlaces.getPlacemarks().add(convertToPlacemarkDTO(startAndFinish.getA()));
|
||||
if (withAdditionalData) {
|
||||
//Getting the places of the race
|
||||
Pair<Placemark, Placemark> startAndFinish = trackedRace.getStartFinishPlacemarks();
|
||||
PlacemarkOrderDTO racePlaces = new PlacemarkOrderDTO();
|
||||
if (startAndFinish.getA() != null) {
|
||||
racePlaces.getPlacemarks().add(convertToPlacemarkDTO(startAndFinish.getA()));
|
||||
}
|
||||
if (startAndFinish.getB() != null) {
|
||||
racePlaces.getPlacemarks().add(convertToPlacemarkDTO(startAndFinish.getB()));
|
||||
}
|
||||
if (racePlaces.isEmpty()) {
|
||||
racePlaces = null;
|
||||
}
|
||||
//Creating raceDTO and getting the dates
|
||||
race = new StrippedRaceDTO(trackedRace.getRace().getName(), raceIdentifier, racePlaces);
|
||||
race.startOfRace = trackedRace.getStart() == null ? null : trackedRace.getStart().asDate();
|
||||
race.startOfTracking = trackedRace.getStartOfTracking() == null ? null : trackedRace
|
||||
.getStartOfTracking().asDate();
|
||||
race.endOfRace = trackedRace.getAssumedEnd() == null ? null : trackedRace.getAssumedEnd().asDate();
|
||||
}
|
||||
if (startAndFinish.getB() != null) {
|
||||
racePlaces.getPlacemarks().add(convertToPlacemarkDTO(startAndFinish.getB()));
|
||||
}
|
||||
if (racePlaces.isEmpty()) {
|
||||
racePlaces = null;
|
||||
}
|
||||
|
||||
//Creating raceDTO and getting the dates
|
||||
race = new StrippedRaceDTO(trackedRace.getRace().getName(), raceIdentifier, racePlaces);
|
||||
race.startOfTracking = trackedRace.getStartOfTracking().asDate();
|
||||
race.startOfRace = trackedRace.getStart().asDate();
|
||||
race.endOfRace = trackedRace.getAssumedEnd() == null ? null : trackedRace.getAssumedEnd().asDate();
|
||||
}
|
||||
dto.addRace(raceColumn.getName(), raceColumn.isMedalRace(), raceIdentifier, race);
|
||||
}
|
||||
@@ -1390,12 +1374,14 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
|
||||
@Override
|
||||
public MultiCompetitorRaceDataDTO getCompetitorsRaceData(RaceIdentifier race, List<Pair<Date, CompetitorDTO>> competitorsQuery,
|
||||
long stepSize, DetailType detailType) throws NoWindException {
|
||||
Date toDate, long stepSize, DetailType detailType) throws NoWindException {
|
||||
MultiCompetitorRaceDataDTO data = null;
|
||||
TrackedRace trackedRace = getExistingTrackedRace(race);
|
||||
if (trackedRace != null) {
|
||||
TimePoint newestEvent = trackedRace.getTimePointOfNewestEvent();
|
||||
TimePoint endTime = (toDate == null || toDate.after(newestEvent.asDate())) ? newestEvent : new MillisecondsTimePoint(toDate);
|
||||
data = getMultiCompetitorRaceDataDTO(trackedRace, competitorsQuery, trackedRace.getStart(),
|
||||
trackedRace.getTimePointOfNewestEvent(), stepSize, detailType);
|
||||
endTime, stepSize, detailType);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -1604,7 +1590,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
groupDTO.name = leaderboardGroup.getName();
|
||||
groupDTO.description = leaderboardGroup.getDescription();
|
||||
for (Leaderboard leaderboard : leaderboardGroup.getLeaderboards()) {
|
||||
groupDTO.leaderboards.add(createStrippedLeaderboardDTO(leaderboard));
|
||||
groupDTO.leaderboards.add(createStrippedLeaderboardDTO(leaderboard, true));
|
||||
}
|
||||
return groupDTO;
|
||||
}
|
||||
|
||||
+2
-3
@@ -50,9 +50,8 @@ public class CompetitorRaceDataDTO implements IsSerializable {
|
||||
* Takes the {@link Date} of the last elements in {@link #raceData} and {@link #markPassingsData} and returns the newer date.
|
||||
*/
|
||||
public Date getDateOfNewestData() {
|
||||
Date dateOfNewestRaceData = raceData.get(raceData.size() - 1).getA();
|
||||
Date dateOfNewestMarkPassing = markPassingsData.get(markPassingsData.size() - 1).getB();
|
||||
return dateOfNewestRaceData.after(dateOfNewestMarkPassing) ? dateOfNewestRaceData : dateOfNewestMarkPassing;
|
||||
Date dateOfNewestRaceData = !raceData.isEmpty() ? raceData.get(raceData.size() - 1).getA() : null;
|
||||
return dateOfNewestRaceData != null ? dateOfNewestRaceData : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -86,7 +86,8 @@ public class MultiCompetitorRaceDataDTO implements IsSerializable {
|
||||
if (dateOfNewestData == null) {
|
||||
dateOfNewestData = raceDateOfNewestData;
|
||||
} else {
|
||||
dateOfNewestData = dateOfNewestData.after(raceDateOfNewestData) ? dateOfNewestData : raceDateOfNewestData;
|
||||
dateOfNewestData = (dateOfNewestData.after(raceDateOfNewestData) || raceDateOfNewestData == null) ? dateOfNewestData
|
||||
: raceDateOfNewestData;
|
||||
}
|
||||
}
|
||||
return dateOfNewestData;
|
||||
@@ -99,7 +100,8 @@ public class MultiCompetitorRaceDataDTO implements IsSerializable {
|
||||
if (dateOfNewestData == null) {
|
||||
dateOfNewestData = raceDateOfNewestData;
|
||||
} else {
|
||||
dateOfNewestData = dateOfNewestData.before(raceDateOfNewestData) ? dateOfNewestData : raceDateOfNewestData;
|
||||
dateOfNewestData = (dateOfNewestData.before(raceDateOfNewestData) || raceDateOfNewestData == null) ? dateOfNewestData
|
||||
: raceDateOfNewestData;
|
||||
}
|
||||
}
|
||||
return dateOfNewestData;
|
||||
|
||||
-7
@@ -5,8 +5,6 @@ import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.tools.ant.taskdefs.Sleep;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
@@ -83,7 +81,6 @@ public class LeaderboardGroupOverviewPanel extends FormPanel {
|
||||
private SingleSelectionModel<LeaderboardDTO> leaderboardsSelectionModel;
|
||||
|
||||
private CellTable<RaceInLeaderboardDTO> racesTable;
|
||||
private ListDataProvider<RaceInLeaderboardDTO> racesDataProvider;
|
||||
private SingleSelectionModel<RaceInLeaderboardDTO> racesSelectionModel;
|
||||
|
||||
|
||||
@@ -440,10 +437,6 @@ public class LeaderboardGroupOverviewPanel extends FormPanel {
|
||||
});
|
||||
}
|
||||
|
||||
private void groupSelectionChanged() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
private void onCheckBoxLiveChange() {
|
||||
if (onlyLiveCheckBox.getValue()) {
|
||||
String today = DateTimeFormat.getFormat("dd.MM.yyyy").format(new Date()).toString();
|
||||
|
||||
Reference in New Issue
Block a user