b3239227d41914434c52e79c420017e459d09e67
java/com.sap.sailing.domain.racelogtrackingadapter/src/com/sap/sailing/domain/racelogtracking/impl/fixtracker/FixLoaderAndTracker.java
| ... | ... | @@ -964,9 +964,10 @@ public class FixLoaderAndTracker implements TrackingDataLoader { |
| 964 | 964 | } |
| 965 | 965 | |
| 966 | 966 | /** |
| 967 | - * This is used when device mappings for an item changed so that fixes in a new {@link TimeRange} are covered. This is also used when initially loading fixes due to startOfTracking being initially set. If |
|
| 968 | - * the mapping is a {@link Mark}, best fixes outside of the tracking {@link TimeRange} are loaded if none is |
|
| 969 | - * available in the tracking {@link TimeRange}. |
|
| 967 | + * This is used when device mappings for an item changed so that fixes in a new {@link TimeRange} are covered. This |
|
| 968 | + * is also used when initially loading fixes due to startOfTracking being initially set. If the mapping is a |
|
| 969 | + * {@link Mark}, best fixes outside of the tracking {@link TimeRange} are loaded if none is available in the |
|
| 970 | + * tracking {@link TimeRange}. |
|
| 970 | 971 | */ |
| 971 | 972 | private class LoadFixesForNewlyCoveredTimeRangesJob extends AbstractLoadingJob { |
| 972 | 973 | private final WithID item; |
java/com.sap.sailing.domain/src/com/sap/sailing/domain/racelog/RaceLogAndTrackedRaceResolver.java
| ... | ... | @@ -9,6 +9,7 @@ import com.sap.sailing.domain.base.Fleet; |
| 9 | 9 | import com.sap.sailing.domain.base.RaceColumn; |
| 10 | 10 | import com.sap.sailing.domain.common.RegattaAndRaceIdentifier; |
| 11 | 11 | import com.sap.sailing.domain.leaderboard.Leaderboard; |
| 12 | +import com.sap.sailing.domain.leaderboard.impl.DelegatingRegattaLeaderboardWithCompetitorElimination; |
|
| 12 | 13 | import com.sap.sailing.domain.regattalike.IsRegattaLike; |
| 13 | 14 | import com.sap.sailing.domain.tracking.TrackedRace; |
| 14 | 15 | import com.sap.sse.common.Util.Triple; |
| ... | ... | @@ -31,13 +32,20 @@ public interface RaceLogAndTrackedRaceResolver extends RaceLogResolver { |
| 31 | 32 | /** |
| 32 | 33 | * Determines those {@link RaceColumn}/{@link Fleet} combinations ("slots") from all {@link Leaderboard}s managed by |
| 33 | 34 | * this resolver that the tracked race identified by {@code trackedRaceIdentifier} shall be linked to when loaded. |
| 34 | - * This information is relevant, e.g., after having created a {@link TrackedRace} that previously was attached to |
|
| 35 | - * one or more such "slots" and shall now be re-connected to those same slots again. It is also helpful, e.g., when |
|
| 36 | - * trying to figure out which race logs will be |
|
| 35 | + * Duplicate {@link RaceColumn}s are ignored; such duplicates may occur, e.g., if one {@link Leaderboard} is a view |
|
| 36 | + * of another one, as is the case for a {@link DelegatingRegattaLeaderboardWithCompetitorElimination}. In such |
|
| 37 | + * scenarios, the leaderboard returned as the {@link Triple#getA() first} component of the resulting triple is |
|
| 38 | + * randomly picked from those leaderboards {@link Leaderboard#getRaceColumns() listing} this column. |
|
| 39 | + * <p> |
|
| 40 | + * |
|
| 41 | + * The information returned is relevant, e.g., after having created a {@link TrackedRace} that previously was |
|
| 42 | + * attached to one or more such "slots" and shall now be re-connected to those same slots again. It is also helpful, |
|
| 43 | + * e.g., when trying to figure out which race logs will be |
|
| 37 | 44 | * {@link TrackedRace#attachRegattaLog(com.sap.sailing.domain.abstractlog.regatta.RegattaLog) attached} to that |
| 38 | 45 | * {@link TrackedRace} because usually each "slot" comes with its own {@link RaceLog}, so that attaching to multiple |
| 39 | 46 | * slots will result in multiple race logs being attached to the tracked race. |
| 40 | 47 | */ |
| 41 | - List<Triple<Leaderboard, RaceColumn, Fleet>> getColumnsWithRaceLogForTrackedRace(RegattaAndRaceIdentifier trackedRaceIdentifier); |
|
| 48 | + List<Triple<Leaderboard, RaceColumn, Fleet>> getColumnsWithRaceLogForTrackedRace( |
|
| 49 | + RegattaAndRaceIdentifier trackedRaceIdentifier); |
|
| 42 | 50 | |
| 43 | 51 | } |
java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java
| ... | ... | @@ -2743,12 +2743,15 @@ Replicator { |
| 2743 | 2743 | @Override |
| 2744 | 2744 | public List<Triple<Leaderboard, RaceColumn, Fleet>> getColumnsWithRaceLogForTrackedRace( |
| 2745 | 2745 | final RegattaAndRaceIdentifier trackedRaceIdentifier) { |
| 2746 | + final Set<RaceColumn> raceColumnsVisited = new HashSet<>(); |
|
| 2746 | 2747 | final List<Triple<Leaderboard, RaceColumn, Fleet>> trackedRaceLink = new ArrayList<>(); |
| 2747 | 2748 | for (Leaderboard leaderboard : getLeaderboards().values()) { |
| 2748 | 2749 | for (RaceColumn column : leaderboard.getRaceColumns()) { |
| 2749 | - for (Fleet fleet : column.getFleets()) { |
|
| 2750 | - if (trackedRaceIdentifier.equals(column.getRaceIdentifier(fleet))) { |
|
| 2751 | - trackedRaceLink.add(new Triple<>(leaderboard, column, fleet)); |
|
| 2750 | + if (raceColumnsVisited.add(column)) { // avoid visiting the same column multiple times in case it's shared across multiple leaderboards |
|
| 2751 | + for (Fleet fleet : column.getFleets()) { |
|
| 2752 | + if (trackedRaceIdentifier.equals(column.getRaceIdentifier(fleet))) { |
|
| 2753 | + trackedRaceLink.add(new Triple<>(leaderboard, column, fleet)); |
|
| 2754 | + } |
|
| 2752 | 2755 | } |
| 2753 | 2756 | } |
| 2754 | 2757 | } |