mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 14:57:12 +00:00
Regatta list - Added utility methods to DTOs
This commit is contained in:
1 parent
5b9d0b522d
commit
f6142f2c05
2 files changed
+19
-1
No files matched your search
+17
@@ -35,4 +35,21 @@ public class RegattaProgressSeriesDTO implements DTO {
|
||||
public void addFleet(FleetMetadataDTO fleet, int raceCount) {
|
||||
fleetState.put(fleet, raceCount);
|
||||
}
|
||||
|
||||
public boolean isCompleted() {
|
||||
for (Integer numberOfRace : fleetState.values()) {
|
||||
if (numberOfRace < totalRaceCount) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !fleetState.isEmpty();
|
||||
}
|
||||
|
||||
public int getProgressRaceCount() {
|
||||
int progressRaceCount = 0;
|
||||
for (Integer numberOfRace : fleetState.values()) {
|
||||
progressRaceCount = Math.max(progressRaceCount, numberOfRace);
|
||||
}
|
||||
return progressRaceCount;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class FleetMetadataDTO implements IsSerializable, Comparable<FleetMetadataDTO> {
|
||||
|
||||
private static final String DEFAULT_FLEET_COLOR = "#f0ab00";
|
||||
private String fleetName;
|
||||
private String fleetColor;
|
||||
|
||||
@@ -22,7 +23,7 @@ public class FleetMetadataDTO implements IsSerializable, Comparable<FleetMetadat
|
||||
}
|
||||
|
||||
public String getFleetColor() {
|
||||
return fleetColor;
|
||||
return fleetColor == null || fleetColor.isEmpty() ? DEFAULT_FLEET_COLOR : fleetColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user