mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
bug3465: fix duplicates in RegattaOverview list
This commit is contained in:
1 parent
1ff9dc1a58
commit
2bbeda0d45
2 files changed
+16
-15
No files matched your search
-7
@@ -81,7 +81,6 @@ public class RegattaOverviewPanel extends SimplePanel {
|
||||
final ErrorReporter errorReporter,
|
||||
final StringMessages stringMessages,
|
||||
RegattaOverviewContextDefinition regattaOverviewContextDefinition) {
|
||||
|
||||
this.sailingService = sailingService;
|
||||
this.stringMessages = stringMessages;
|
||||
this.errorReporter = errorReporter;
|
||||
@@ -91,29 +90,24 @@ public class RegattaOverviewPanel extends SimplePanel {
|
||||
this.eventDTO = null;
|
||||
this.raceGroupDTOs = new ArrayList<RaceGroupDTO>();
|
||||
this.userService = userService;
|
||||
|
||||
mainPanel = new VerticalPanel();
|
||||
setWidget(mainPanel);
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.addStyleName(style.contentWrapper());
|
||||
|
||||
refreshNowButton = new Anchor(stringMessages.refreshNow());
|
||||
refreshNowButton.setStyleName(RES.mainCss().button());
|
||||
refreshNowButton.addStyleName(style.button());
|
||||
|
||||
refreshNowButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
regattaRaceStatesComponent.loadAndUpdateEventLog();
|
||||
}
|
||||
|
||||
});
|
||||
settingsButton = new Anchor(" ", true);
|
||||
settingsButton.ensureDebugId("RegattaOverviewSettingsButton");
|
||||
settingsButton.setStyleName(style.settingsButton());
|
||||
settingsButton.addStyleName(RES.mainCss().button());
|
||||
settingsButton.addStyleName(style.button());
|
||||
|
||||
settingsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -138,7 +132,6 @@ public class RegattaOverviewPanel extends SimplePanel {
|
||||
startStopUpdatingButton.addStyleName(style.refreshButton_live());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
// FIXME The chained calls from here are independent from each other and should be implemented with Dispatching Framework
|
||||
sailingService.getEventById(regattaOverviewContextDefinition.getEvent(), false, new MarkedAsyncCallback<EventDTO>(
|
||||
|
||||
+16
-8
@@ -5561,15 +5561,19 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet
|
||||
newEvent.getWindFinderReviewedSpotsCollectionIds());
|
||||
}
|
||||
|
||||
private Triple<String, String, String> getLeaderboardSlotKey(RegattaOverviewEntryDTO entry) {
|
||||
return new Triple<>(entry.leaderboardName, entry.raceInfo.raceName, entry.raceInfo.fleetName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegattaOverviewEntryDTO> getRaceStateEntriesForRaceGroup(UUID eventId, List<UUID> visibleCourseAreaIds,
|
||||
List<String> visibleRegattas, boolean showOnlyCurrentlyRunningRaces, boolean showOnlyRacesOfSameDay, Duration clientTimeZoneOffset)
|
||||
throws NoWindException, InterruptedException, ExecutionException {
|
||||
List<RegattaOverviewEntryDTO> result = new ArrayList<RegattaOverviewEntryDTO>();
|
||||
Calendar dayToCheck = Calendar.getInstance();
|
||||
dayToCheck.setTime(new Date());
|
||||
Event event = getService().getEvent(eventId);
|
||||
getSecurityService().checkCurrentUserReadPermission(event);
|
||||
final Map<Triple<String, String, String>, RegattaOverviewEntryDTO> entriesByRaceIdentifier = new HashMap<>();
|
||||
if (event != null) {
|
||||
for (CourseArea courseArea : event.getVenue().getCourseAreas()) {
|
||||
if (visibleCourseAreaIds.contains(courseArea.getId())) {
|
||||
@@ -5579,20 +5583,24 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet
|
||||
// race entries that either have no course area explicitly defined or otherwise have
|
||||
// a course area that is part of the visibleCourseAreaIds
|
||||
if (Util.contains(leaderboard.getCourseAreas(), courseArea)) {
|
||||
Util.addAll(
|
||||
Util.filter(
|
||||
getRaceStateEntriesForLeaderboard(leaderboard.getName(),
|
||||
for (final RegattaOverviewEntryDTO entry : getRaceStateEntriesForLeaderboard(leaderboard.getName(),
|
||||
showOnlyCurrentlyRunningRaces, showOnlyRacesOfSameDay, clientTimeZoneOffset,
|
||||
visibleRegattas),
|
||||
entry->entry.courseAreaIdAsString == null || visibleCourseAreaIds.contains(UUID.fromString(
|
||||
entry.courseAreaIdAsString))), result);
|
||||
visibleRegattas)) {
|
||||
// use "leaderboard slot key" consisting of leaderboard name / race column name / fleet name
|
||||
// because the raceInfo.raceIdentifier could be null as no TrackedRace has to be attached
|
||||
if (!entriesByRaceIdentifier.containsKey(getLeaderboardSlotKey(entry)) &&
|
||||
(entry.courseAreaIdAsString == null || visibleCourseAreaIds.contains(UUID.fromString(
|
||||
entry.courseAreaIdAsString)))) {
|
||||
entriesByRaceIdentifier.put(getLeaderboardSlotKey(entry), entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return new ArrayList<>(entriesByRaceIdentifier.values());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user