mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-28 00:16:46 +00:00
Limiting the to-Timepoint to the timePointOfNewestEvent for the chart data services
This commit is contained in:
+1
-1
@@ -160,6 +160,6 @@ 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,
|
||||
Date to, long stepSize, DetailType detailType)
|
||||
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, Date to, long stepSize,
|
||||
void getCompetitorsRaceData(RaceIdentifier race, List<Pair<Date,CompetitorDTO>> competitorsToLoad, Date toDate, long stepSize,
|
||||
DetailType detailType, AsyncCallback<MultiCompetitorRaceDataDTO> callback);
|
||||
}
|
||||
|
||||
+9
-12
@@ -44,7 +44,6 @@ import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.TimeListener;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.client.Timer.PlayModes;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorRaceDataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.MultiCompetitorRaceDataDTO;
|
||||
@@ -118,8 +117,7 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
|
||||
List<RaceIdentifier> selectedRaces = raceSelectionProvider.getSelectedRaces();
|
||||
if(!selectedRaces.isEmpty()) {
|
||||
Date to = timer.getPlayMode() == PlayModes.Live ? new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()) : null;
|
||||
loadData(true, to);
|
||||
loadData(true);
|
||||
}
|
||||
timer.addTimeListener(this);
|
||||
}
|
||||
@@ -184,9 +182,8 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
* If no competitor is visible, is the {@link #noCompetitorsSelectedLabel} displayed.
|
||||
*
|
||||
* @param showBusyIndicator If <code>true</code> is the busy indicator shown while loading the data from the server.
|
||||
* @param to The date until the data should be loaded
|
||||
*/
|
||||
protected void loadData(boolean showBusyIndicator, Date to) {
|
||||
protected void loadData(boolean showBusyIndicator) {
|
||||
if (hasVisibleCompetitors()) {
|
||||
if (showBusyIndicator) {
|
||||
setWidget(busyIndicatorPanel);
|
||||
@@ -206,7 +203,8 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
}
|
||||
}
|
||||
|
||||
sailingService.getCompetitorsRaceData(getSelectedRace(), dataQuery, to, getStepSize(), getDataToShow(),
|
||||
sailingService.getCompetitorsRaceData(getSelectedRace(), dataQuery, new Date(System.currentTimeMillis()
|
||||
- timer.getLivePlayDelayInMillis()), getStepSize(), getDataToShow(),
|
||||
new AsyncCallback<MultiCompetitorRaceDataDTO>() {
|
||||
|
||||
@Override
|
||||
@@ -247,8 +245,7 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
|
||||
@Override
|
||||
public void addedToSelection(CompetitorDTO competitor) {
|
||||
Date to = timer.getPlayMode() == PlayModes.Live ? new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()) : null;
|
||||
loadData(true, to);
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -424,7 +421,7 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
|
||||
/**
|
||||
* Updates the settings known to be contained in {@link ChartSettings}. Subclasses have to update settings provided
|
||||
* by subclasses thereof. Subclasses also need to call {@link #clearChart()} and {@link #loadData(boolean, Date)}, if this method returns <code>true</code>;
|
||||
* by subclasses thereof. Subclasses also need to call {@link #clearChart()} and {@link #loadData(boolean)}, if this method returns <code>true</code>;
|
||||
*
|
||||
* @return <code>true</code> if the settings had been changed and a clearing and loading is needed.
|
||||
*/
|
||||
@@ -455,7 +452,7 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
|
||||
/**
|
||||
* Updates the {@link #dataToShow} field, creates a new chart for the new <code>dataToShow</code> and clears the {@link #chartData}.<br />
|
||||
* Doesn't {@link #loadData(boolean, Date) load the data}.
|
||||
* Doesn't {@link #loadData(boolean) load the data}.
|
||||
*
|
||||
* @return <code>true</code> if the data to show changed
|
||||
*/
|
||||
@@ -484,7 +481,7 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
public void onRaceSelectionChange(List<RaceIdentifier> selectedRaces) {
|
||||
setChartData(null);
|
||||
clearChart();
|
||||
loadData(true, null);
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -533,7 +530,7 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
Date newestEvent = getChartData().getOldestDateOfNewestData();
|
||||
if (hasVisibleCompetitors()
|
||||
&& (newestEvent == null || (newestEvent.before(date) && (date.getTime() - newestEvent.getTime()) >= getStepSize()))) {
|
||||
loadData(false, new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()));
|
||||
loadData(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class ChartPanel extends AbstractChartPanel<ChartSettings> implements Com
|
||||
updateSettingsOnly(newSettings);
|
||||
clearChart();
|
||||
Date to = timer.getPlayMode() == PlayModes.Live ? new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()) : null;
|
||||
loadData(true, to);
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class MultiChartPanel extends AbstractChartPanel<MultiChartSettings> impl
|
||||
if (dataToShowChanged || settingsChanged) {
|
||||
clearChart();
|
||||
Date to = timer.getPlayMode() == PlayModes.Live ? new Date(System.currentTimeMillis() - timer.getLivePlayDelayInMillis()) : null;
|
||||
loadData(true, to);
|
||||
loadData(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -537,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) {
|
||||
@@ -1373,11 +1374,12 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
|
||||
@Override
|
||||
public MultiCompetitorRaceDataDTO getCompetitorsRaceData(RaceIdentifier race, List<Pair<Date, CompetitorDTO>> competitorsQuery,
|
||||
Date to, 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 endTime = to != null ? new MillisecondsTimePoint(to) : trackedRace.getTimePointOfNewestEvent();
|
||||
TimePoint newestEvent = trackedRace.getTimePointOfNewestEvent();
|
||||
TimePoint endTime = (toDate == null || toDate.after(newestEvent.asDate())) ? newestEvent : new MillisecondsTimePoint(toDate);
|
||||
data = getMultiCompetitorRaceDataDTO(trackedRace, competitorsQuery, trackedRace.getStart(),
|
||||
endTime, stepSize, detailType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user