bug 4345: fixing check whether course must be displayed per-race

Change-Id: Id0e045541d52c02cf8d3f6f13cda0afe6d5388a5
This commit is contained in:
Axel Uhl committed 2017-10-18 13:43:03 +02:00
1 parent 9f6677b6ce
commit 9546300b31
1 file changed
+4 -14
@@ -182,11 +182,9 @@ public class RegattaRaceStatesComponent extends AbstractCompositeComponent<Regat
boolean canRemoveBoatClass = true; boolean canRemoveBoatClass = true;
boolean canRemoveLastUpdate = true; boolean canRemoveLastUpdate = true;
boolean canRemoveProtestTime = true; boolean canRemoveProtestTime = true;
boolean first = true; boolean first = true;
for (RegattaOverviewEntryDTO loopEntryDTO : allEntries) { for (RegattaOverviewEntryDTO loopEntryDTO : allEntries) {
final RaceInfoDTO loopRaceInfo = loopEntryDTO.raceInfo; final RaceInfoDTO loopRaceInfo = loopEntryDTO.raceInfo;
if (canRemoveLastUpdate && timePassedInSeconds(loopRaceInfo.lastUpdateTime) <= HIDE_COL_TIME_THRESHOLD) { if (canRemoveLastUpdate && timePassedInSeconds(loopRaceInfo.lastUpdateTime) <= HIDE_COL_TIME_THRESHOLD) {
canRemoveLastUpdate = false; canRemoveLastUpdate = false;
} }
@@ -194,42 +192,34 @@ public class RegattaRaceStatesComponent extends AbstractCompositeComponent<Regat
&& timePassedInSeconds(loopRaceInfo.protestFinishTime) <= HIDE_COL_TIME_THRESHOLD) { && timePassedInSeconds(loopRaceInfo.protestFinishTime) <= HIDE_COL_TIME_THRESHOLD) {
canRemoveProtestTime = false; canRemoveProtestTime = false;
} }
if (first) { if (first) {
firstRegattaName = loopEntryDTO.regattaDisplayName; firstRegattaName = loopEntryDTO.regattaDisplayName;
firstRegattaNameEntry = loopEntryDTO; firstRegattaNameEntry = loopEntryDTO;
firstCourseAreaName = loopEntryDTO.courseAreaName; firstCourseAreaName = loopEntryDTO.courseAreaName;
firstCourseName = loopRaceInfo.lastCourseName; firstCourseName = loopRaceInfo.lastCourseName;
firstCourseRegattaOverviewEntry = loopRaceInfo; firstCourseRegattaOverviewEntry = loopRaceInfo;
lastBoatClass = loopEntryDTO.boatClassName; lastBoatClass = loopEntryDTO.boatClassName;
} else { } else {
if (canRemoveRegatta && !Util.equalsWithNull(firstRegattaName, loopEntryDTO.regattaDisplayName)) { if (canRemoveRegatta && !Util.equalsWithNull(firstRegattaName, loopEntryDTO.regattaDisplayName)) {
canRemoveRegatta = false; canRemoveRegatta = false;
} }
if (canRemoveCourseArea && !Util.equalsWithNull(firstCourseAreaName, loopEntryDTO.courseAreaName)) { if (canRemoveCourseArea && !Util.equalsWithNull(firstCourseAreaName, loopEntryDTO.courseAreaName)) {
canRemoveCourseArea = false; canRemoveCourseArea = false;
} }
// a course must be shown individually for a race if its name or its course design differs
if (canRemoveCourse && !Util.equalsWithNull(firstCourseName, loopRaceInfo.lastCourseName) if (canRemoveCourse && (!Util.equalsWithNull(firstCourseName, loopRaceInfo.lastCourseName)
&& !Util.equalsWithNull(firstCourseRegattaOverviewEntry.lastCourseDesign, || !Util.equalsWithNull(firstCourseRegattaOverviewEntry.lastCourseDesign,
loopRaceInfo.lastCourseDesign)) { loopRaceInfo.lastCourseDesign))) {
canRemoveCourse = false; canRemoveCourse = false;
} }
if (canRemoveBoatClass && !Util.equalsWithNull(lastBoatClass, loopEntryDTO.boatClassName)) { if (canRemoveBoatClass && !Util.equalsWithNull(lastBoatClass, loopEntryDTO.boatClassName)) {
canRemoveBoatClass = false; canRemoveBoatClass = false;
} }
} }
first = false; first = false;
} }
// final RegattaOverviewEntryDTO entryForRepeatedInfos = firstEntry; // final RegattaOverviewEntryDTO entryForRepeatedInfos = firstEntry;
repeatedInfoLabel.clear(); repeatedInfoLabel.clear();
boolean isAppending = false; boolean isAppending = false;
RegattaOverviewEntryDTO _firstRegattaNameEntry = firstRegattaNameEntry; RegattaOverviewEntryDTO _firstRegattaNameEntry = firstRegattaNameEntry;
isAppending |= collectRepeatedInfos(stringMessages.regatta(), firstRegattaName, canRemoveRegatta, isAppending |= collectRepeatedInfos(stringMessages.regatta(), firstRegattaName, canRemoveRegatta,