Do not duplicate marks when copying course and competitors

This commit is contained in:
Jan Broß committed 2015-10-30 11:42:55 +01:00
1 parent db61a43cda
commit 4d7eed5032
4 files changed
+4 -17

No files matched your search

@@ -5,7 +5,6 @@ import java.util.Set;
import com.sap.sailing.domain.abstractlog.race.RaceLog;
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDefineMarkEvent;
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogStartTrackingEvent;
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
@@ -114,9 +113,8 @@ public interface RaceLogTrackingAdapter {
String emails, Locale locale) throws MailException;
/**
* Duplicate the course in the newest {@link RaceLogCourseDesignChangedEvent} in {@code from} race log to the
* {@code to} race logs. The {@link Mark}s and {@link ControlPoint}s are duplicated and not reused. This also
* inserts the necessary {@link RaceLogDefineMarkEvent}s into the {@code to} race logs.
* Copy the course in the newest {@link RaceLogCourseDesignChangedEvent} in {@code from} race log to the
* {@code to} race logs. The {@link Mark}s and {@link ControlPoint}s are reused and not duplicated.
*/
void copyCourse(RaceLog fromRaceLog, Set<RaceLog> toRaceLogs, SharedDomainFactory baseDomainFactory,
RacingEventService service);
@@ -209,11 +209,6 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter {
course.getWaypoints().forEach(wp -> Util.addAll(wp.getMarks(), marks));
}
final List<RaceLogEvent> raceLogDeviceMarkMappingEvents = new AllEventsOfTypeFinder<>(fromRaceLog, /*
* only
* unrevoked
*/true,
RaceLogDeviceMarkMappingEvent.class).analyze();
for (RaceLog toRaceLog : toRaceLogs) {
if (new RaceLogTrackingStateAnalyzer(toRaceLog).analyze().isForTracking()) {
if (course != null) {
@@ -224,14 +219,6 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter {
for (Waypoint oldWaypoint : course.getWaypoints()) {
newCourse.addWaypoint(i++, oldWaypoint);
}
for (Mark mark : marks) {
RaceLogEvent event = RaceLogEventFactory.INSTANCE.createDefineMarkEvent(now,
service.getServerAuthor(), toRaceLog.getCurrentPassId(), mark);
toRaceLog.add(event);
}
for (RaceLogEvent raceLogDeviceMarkMappingEvent : raceLogDeviceMarkMappingEvents) {
toRaceLog.add(raceLogDeviceMarkMappingEvent);
}
int passId = toRaceLog.getCurrentPassId();
RaceLogEvent newCourseEvent = RaceLogEventFactory.INSTANCE.createCourseDesignChangedEvent(now,
service.getServerAuthor(), passId, newCourse);
@@ -4,6 +4,7 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
import com.sap.sailing.domain.abstractlog.shared.events.DeviceMarkMappingEvent;
@Deprecated //(see bug2851)
public interface RaceLogDeviceMarkMappingEvent extends RaceLogEvent,
DeviceMarkMappingEvent<RaceLogEventVisitor> {
@@ -9,6 +9,7 @@ import com.sap.sailing.domain.base.Mark;
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
import com.sap.sse.common.TimePoint;
@Deprecated //see bug2851
public class RaceLogDeviceMarkMappingEventImpl extends AbstractRaceLogDeviceMappingEventImpl<Mark>
implements RaceLogDeviceMarkMappingEvent {
private static final long serialVersionUID = -7223543830755457196L;