mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
Removed WindStrength as DimensionIdentifier
This commit is contained in:
1 parent
9bdfbff531
commit
efe72d257e
3 files changed
+8
-9
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum DimensionIdentifier {
|
public enum DimensionIdentifier {
|
||||||
RegattaName, BoatClassName, CourseAreaName, FleetName, RaceName, LegType, LegNumber, Nationality, CompetitorName, SailID, WindStrength, Year;
|
RegattaName, BoatClassName, CourseAreaName, FleetName, RaceName, LegType, LegNumber, Nationality, CompetitorName, SailID, Year;
|
||||||
|
|
||||||
public static class OrdinalComparator implements Comparator<DimensionIdentifier> {
|
public static class OrdinalComparator implements Comparator<DimensionIdentifier> {
|
||||||
private static final List<DimensionIdentifier> dimensions = Arrays.asList(DimensionIdentifier.values());
|
private static final List<DimensionIdentifier> dimensions = Arrays.asList(DimensionIdentifier.values());
|
||||||
|
|||||||
-2
@@ -78,8 +78,6 @@ public class DeprecatedEnumsToFunctionDTOConverter {
|
|||||||
functionDTO = new FunctionDTOImpl("getCompetitor -> getBoat -> getSailID", HasTrackedLegOfCompetitorContext.class.getSimpleName(),
|
functionDTO = new FunctionDTOImpl("getCompetitor -> getBoat -> getSailID", HasTrackedLegOfCompetitorContext.class.getSimpleName(),
|
||||||
String.class.getSimpleName(), new ArrayList<String>(), "Sail ID", true);
|
String.class.getSimpleName(), new ArrayList<String>(), "Sail ID", true);
|
||||||
break;
|
break;
|
||||||
case WindStrength:
|
|
||||||
break;
|
|
||||||
case Year:
|
case Year:
|
||||||
functionDTO = new FunctionDTOImpl("getYear", HasTrackedRaceContext.class.getSimpleName(),
|
functionDTO = new FunctionDTOImpl("getYear", HasTrackedRaceContext.class.getSimpleName(),
|
||||||
"Integer", new ArrayList<String>(), "Year", true);
|
"Integer", new ArrayList<String>(), "Year", true);
|
||||||
|
|||||||
+7
-6
@@ -52,26 +52,27 @@ public class TrackedRaceWithContext implements HasTrackedRaceContext {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RaceDefinition getRace() {
|
public RaceDefinition getRace() {
|
||||||
return trackedRace.getRace();
|
return getTrackedRace().getRace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getYear() {
|
public Integer getYear() {
|
||||||
if (!yearHasBeenInitialized) {
|
if (!yearHasBeenInitialized) {
|
||||||
initializeYear();
|
year = calculateYear();
|
||||||
|
yearHasBeenInitialized = true;
|
||||||
}
|
}
|
||||||
return year;
|
return year;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeYear() {
|
private Integer calculateYear() {
|
||||||
TimePoint time = getTrackedRace().getStartOfRace() != null ? getTrackedRace().getStartOfRace() : getTrackedRace().getStartOfTracking();
|
TimePoint startOfRace = getTrackedRace().getStartOfRace();
|
||||||
|
TimePoint time = startOfRace != null ? startOfRace : getTrackedRace().getStartOfTracking();
|
||||||
if (time == null) {
|
if (time == null) {
|
||||||
year = 0;
|
year = 0;
|
||||||
}
|
}
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(time.asDate());
|
calendar.setTime(time.asDate());
|
||||||
year = calendar.get(Calendar.YEAR);
|
return calendar.get(Calendar.YEAR);
|
||||||
yearHasBeenInitialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user