First implementation to map fginished races

This commit is contained in:
Steffen Schaefer committed 2015-07-06 10:25:46 +02:00
1 parent d1258ee017
commit ceda7ef1a0
2 files changed
+18

No files matched your search

@@ -295,6 +295,19 @@ public class RaceContext {
return null;
}
public RaceListRaceDTO getFinishedRaceOrNull() {
// a race is of 'public interest' of a race is a combination of it's 'live' state
// and special flags states indicating how the postponed/canceled races will be continued
if(getLiveRaceViewState() == RaceViewState.FINISHED) {
// the start time is always given for live races
RaceListRaceDTO liveRaceDTO = new RaceListRaceDTO(getRegattaName(), raceColumn.getName());
fillRaceData(liveRaceDTO);
return liveRaceDTO;
}
return null;
}
private void fillRaceData(RaceMetadataDTO dto) {
dto.setViewState(getLiveRaceViewState());
dto.setRegattaDisplayName(getRegattaDisplayName());
@@ -12,6 +12,11 @@ public class RaceListDataCalculator implements RaceCallback {
@Override
public void doForRace(RaceContext context) {
context.addLiveRace(result.getLiveRaces());
RaceListRaceDTO finishedRace = context.getFinishedRaceOrNull();
if(finishedRace != null) {
result.addRace(finishedRace);
}
}
public ResultWithTTL<RaceListViewDTO> getResult() {