mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
Added methods to the RaceInLeaderboardDTO to get the start date and the places
This commit is contained in:
1 parent
15f2efdf6c
commit
3ba28c304f
3 files changed
+39
-28
No files matched your search
+11
-25
@@ -353,24 +353,17 @@ public class LeaderboardDTO implements IsSerializable {
|
||||
public Date getStartDate() {
|
||||
Date leaderboardStart = null;
|
||||
for (RaceInLeaderboardDTO race : getRaceList()) {
|
||||
if (race.isTrackedRace()) {
|
||||
Date raceStart = null;
|
||||
StrippedRaceDTO raceData = race.getRace();
|
||||
if (raceData != null) {
|
||||
raceStart = raceData.getStartDate();
|
||||
}
|
||||
|
||||
if (raceStart != null) {
|
||||
if (leaderboardStart == null) {
|
||||
leaderboardStart = new Date();
|
||||
}
|
||||
leaderboardStart = leaderboardStart.before(raceStart) ? leaderboardStart : raceStart;
|
||||
Date raceStart = race.getStartDate();
|
||||
if (raceStart != null) {
|
||||
if (leaderboardStart == null) {
|
||||
leaderboardStart = new Date();
|
||||
}
|
||||
leaderboardStart = leaderboardStart.before(raceStart) ? leaderboardStart : raceStart;
|
||||
}
|
||||
}
|
||||
return leaderboardStart;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Takes the {@link PlacemarkOrderDTO} of all races in this leaderboard, if the PlacemarkOrderDTO for the race is
|
||||
* available, and fills all {@link PlacemarkDTO} in a new PlacemarkOrderDTO.<br />
|
||||
@@ -382,19 +375,12 @@ public class LeaderboardDTO implements IsSerializable {
|
||||
public PlacemarkOrderDTO getPlaces() {
|
||||
PlacemarkOrderDTO leaderboardPlaces = null;
|
||||
for (RaceInLeaderboardDTO race : getRaceList()) {
|
||||
if (race.isTrackedRace()) {
|
||||
PlacemarkOrderDTO racePlaces = null;
|
||||
StrippedRaceDTO raceData = race.getRace();
|
||||
if (raceData != null) {
|
||||
racePlaces = raceData.places;
|
||||
}
|
||||
|
||||
if (racePlaces != null) {
|
||||
if (leaderboardPlaces == null) {
|
||||
leaderboardPlaces = new PlacemarkOrderDTO();
|
||||
}
|
||||
leaderboardPlaces.getPlacemarks().addAll(racePlaces.getPlacemarks());
|
||||
PlacemarkOrderDTO racePlaces = race.getPlaces();
|
||||
if (racePlaces != null) {
|
||||
if (leaderboardPlaces == null) {
|
||||
leaderboardPlaces = new PlacemarkOrderDTO();
|
||||
}
|
||||
leaderboardPlaces.getPlacemarks().addAll(racePlaces.getPlacemarks());
|
||||
}
|
||||
}
|
||||
return leaderboardPlaces;
|
||||
|
||||
+25
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
|
||||
@@ -55,6 +57,29 @@ public class RaceInLeaderboardDTO implements IsSerializable {
|
||||
public void setRace(StrippedRaceDTO race) {
|
||||
this.race = race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The start of race, or the start of tracking if the start of race is <code>null</code>, or
|
||||
* <code>null</code> if no start date is available.
|
||||
*/
|
||||
public Date getStartDate() {
|
||||
Date start = null;
|
||||
if (race != null) {
|
||||
start = race.getStartDate();
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The {@link PlacemarkOrderDTO places} or <code>null</code>, if no places are available
|
||||
*/
|
||||
public PlacemarkOrderDTO getPlaces() {
|
||||
PlacemarkOrderDTO places = null;
|
||||
if (race != null) {
|
||||
places = race.places;
|
||||
}
|
||||
return places;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
+3
-3
@@ -371,7 +371,7 @@ public class LeaderboardGroupOverviewPanel extends FormPanel {
|
||||
|
||||
TextColumn<RaceInLeaderboardDTO> racesLocationColumn = new TextColumn<RaceInLeaderboardDTO>() {
|
||||
@Override
|
||||
public String getValue(RaceInLeaderboardDTO object) {
|
||||
public String getValue(RaceInLeaderboardDTO race) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ public class LeaderboardGroupOverviewPanel extends FormPanel {
|
||||
AnchorCell racesNameAnchorCell = new AnchorCell();
|
||||
Column<RaceInLeaderboardDTO, SafeHtml> racesNameColumn = new Column<RaceInLeaderboardDTO, SafeHtml>(racesNameAnchorCell) {
|
||||
@Override
|
||||
public SafeHtml getValue(RaceInLeaderboardDTO object) {
|
||||
public SafeHtml getValue(RaceInLeaderboardDTO race) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public class LeaderboardGroupOverviewPanel extends FormPanel {
|
||||
|
||||
TextColumn<RaceInLeaderboardDTO> racesStartDateColumn = new TextColumn<RaceInLeaderboardDTO>() {
|
||||
@Override
|
||||
public String getValue(RaceInLeaderboardDTO object) {
|
||||
public String getValue(RaceInLeaderboardDTO race) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user