mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 06:17:27 +00:00
Merge branch 'design2015-races' of ssh://sapsailing.com/home/trac/git into design2015-races
# By Steffen Schaefer (5) and fmittag (1) # Via Steffen Schaefer (2) and fmittag (1) * 'design2015-races' of ssh://sapsailing.com/home/trac/git: Fixed NPE in regatta filter if boat category is null Added defaul course area to regatta header body Removed duplicate code Showing default course area for regattas in the event header if there is more than one course area for the event Only showing leaderboard group if there is more than one associated with the event fixed bug during event creation
This commit is contained in:
commit
0bb92a392e
9 files changed
+49
-32
No files matched your search
+7
-1
@@ -56,6 +56,7 @@ public class EventHeader extends Composite {
|
||||
@UiField DivElement races;
|
||||
@UiField DivElement trackedRaces;
|
||||
@UiField DivElement eventCategory;
|
||||
@UiField DivElement courseAreaUi;
|
||||
|
||||
@UiField FlowPanel dropdownContent;
|
||||
|
||||
@@ -123,6 +124,11 @@ public class EventHeader extends Composite {
|
||||
} else {
|
||||
hide(trackedRaces);
|
||||
}
|
||||
if(regattaMetadata.getDefaultCourseAreaName() != null) {
|
||||
courseAreaUi.setInnerText(regattaMetadata.getDefaultCourseAreaName());
|
||||
} else {
|
||||
hide(courseAreaUi);
|
||||
}
|
||||
if(regattaMetadata.getBoatCategory() != null) {
|
||||
eventCategory.setInnerText(regattaMetadata.getBoatCategory());
|
||||
} else {
|
||||
@@ -149,7 +155,7 @@ public class EventHeader extends Composite {
|
||||
hide(eventLink);
|
||||
}
|
||||
|
||||
hide(competitors, races, trackedRaces);
|
||||
hide(competitors, races, trackedRaces, courseAreaUi, eventCategory);
|
||||
}
|
||||
|
||||
initTitleAndSelection(nameToShow);
|
||||
|
||||
+2
-3
@@ -53,9 +53,8 @@
|
||||
<div ui:field="competitors" class="{local_res.css.eventheader_intro_details_item}" />
|
||||
<div ui:field="races" class="{local_res.css.eventheader_intro_details_item}" />
|
||||
<div ui:field="trackedRaces" class="{local_res.css.eventheader_intro_details_item}" />
|
||||
<div ui:field="eventCategory" class="{local_res.css.eventheader_intro_details_item}">
|
||||
<!-- event.category -->
|
||||
</div>
|
||||
<div ui:field="courseAreaUi" class="{local_res.css.eventheader_intro_details_item}" />
|
||||
<div ui:field="eventCategory" class="{local_res.css.eventheader_intro_details_item}" />
|
||||
<!-- IFEND event.eventType === 'multi-regatta-event' -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+4
-1
@@ -41,7 +41,10 @@ public class MultiRegattaList extends Composite implements RefreshableWidget<Sor
|
||||
selectableBoatCategories.clear();
|
||||
for (RegattaWithProgressDTO regattaWithProgress : data) {
|
||||
regattasContainerUi.add(new MultiRegattaListItem(regattaWithProgress, currentPresenter));
|
||||
selectableBoatCategories.add(regattaWithProgress.getBoatCategory());
|
||||
String boatCategory = regattaWithProgress.getBoatCategory();
|
||||
if(boatCategory != null) {
|
||||
selectableBoatCategories.add(boatCategory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ public class RegattaHeaderBody extends UIObject {
|
||||
addDetailsItem(regattaMetadata.getCompetitorsCount(), StringMessages.INSTANCE.competitors());
|
||||
addDetailsItem(regattaMetadata.getRaceCount(), StringMessages.INSTANCE.races());
|
||||
addDetailsItem(regattaMetadata.getTrackedRacesCount(), StringMessages.INSTANCE.trackedRaces());
|
||||
addDetailsItem(regattaMetadata.getDefaultCourseAreaName());
|
||||
addDetailsItem(regattaMetadata.getBoatCategory());
|
||||
}
|
||||
|
||||
|
||||
+19
@@ -22,6 +22,7 @@ import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.domain.leaderboard.FlexibleLeaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
import com.sap.sailing.domain.leaderboard.RegattaLeaderboard;
|
||||
@@ -453,6 +454,7 @@ public final class HomeServiceUtil {
|
||||
regattaDTO.setEndDate(regatta.getEndDate() != null ? regatta.getEndDate().asDate() : null);
|
||||
}
|
||||
regattaDTO.setState(calculateRegattaState(regattaDTO));
|
||||
regattaDTO.setDefaultCourseAreaName(getCourseAreaNameForRegattaIdThereIsMoreThanOne(event, leaderboard));
|
||||
}
|
||||
|
||||
private static boolean hasMultipleLeaderboardGroups(EventBase event) {
|
||||
@@ -469,4 +471,21 @@ public final class HomeServiceUtil {
|
||||
long livePlayDelayInMillis = 15_000;
|
||||
return System.currentTimeMillis() - livePlayDelayInMillis;
|
||||
}
|
||||
|
||||
public static String getCourseAreaNameForRegattaIdThereIsMoreThanOne(EventBase event, Leaderboard leaderboard) {
|
||||
/** The course area will not be shown if there is only one course area defined for the event */
|
||||
if (Util.size(event.getVenue().getCourseAreas()) <= 1) {
|
||||
return null;
|
||||
}
|
||||
CourseArea courseArea = null;
|
||||
if (leaderboard instanceof FlexibleLeaderboard) {
|
||||
courseArea = ((FlexibleLeaderboard) leaderboard).getDefaultCourseArea();
|
||||
} else if(leaderboard instanceof RegattaLeaderboard) {
|
||||
Regatta regatta = ((RegattaLeaderboard) leaderboard).getRegatta();
|
||||
if (regatta != null) {
|
||||
courseArea = regatta.getDefaultCourseArea();
|
||||
}
|
||||
}
|
||||
return courseArea == null ? null : courseArea.getName();
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -3322,11 +3322,13 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
UUID eventUuid = UUID.randomUUID();
|
||||
TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null;
|
||||
TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null;
|
||||
URL officialWebsiteURL = officialWebsiteURLAsString != null ? new URL(officialWebsiteURLAsString) : null;
|
||||
URL sailorsInfoWebsiteURL = sailorsInfoWebsiteURLAsString != null ? new URL(sailorsInfoWebsiteURLAsString) : null;
|
||||
List<ImageDescriptor> eventImages = convertToImages(images);
|
||||
List<VideoDescriptor> eventVideos = convertToVideos(videos);
|
||||
getService().apply(
|
||||
new CreateEvent(eventName, eventDescription, startTimePoint, endTimePoint, venue, isPublic, eventUuid,
|
||||
officialWebsiteURLAsString == null ? null : new URL(officialWebsiteURLAsString), new URL(sailorsInfoWebsiteURLAsString), eventImages, eventVideos));
|
||||
officialWebsiteURL, sailorsInfoWebsiteURL, eventImages, eventVideos));
|
||||
for (String courseAreaName : courseAreaNames) {
|
||||
createCourseArea(eventUuid, courseAreaName);
|
||||
}
|
||||
|
||||
+2
-26
@@ -16,7 +16,6 @@ import com.sap.sailing.domain.abstractlog.race.state.ReadonlyRaceState;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.impl.ReadonlyRaceStateImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.FlagPoleState;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
@@ -40,7 +39,6 @@ import com.sap.sailing.domain.common.media.MediaTrack;
|
||||
import com.sap.sailing.domain.common.racelog.FlagPole;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.domain.leaderboard.FlexibleLeaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.RegattaLeaderboard;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
@@ -272,31 +270,9 @@ public class RaceContext {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Regatta getRegatta() {
|
||||
final Regatta regatta;
|
||||
if (leaderboard instanceof RegattaLeaderboard) {
|
||||
regatta = ((RegattaLeaderboard) leaderboard).getRegatta();
|
||||
} else {
|
||||
regatta = null;
|
||||
}
|
||||
return regatta;
|
||||
}
|
||||
|
||||
|
||||
private String getCourseAreaOrNull() {
|
||||
/** The course area will not be shown if there is only one course area defined for the event */
|
||||
if (Util.size(event.getVenue().getCourseAreas()) <= 1) {
|
||||
return null;
|
||||
}
|
||||
CourseArea courseArea = null;
|
||||
if (leaderboard instanceof FlexibleLeaderboard) {
|
||||
courseArea = ((FlexibleLeaderboard) leaderboard).getDefaultCourseArea();
|
||||
}
|
||||
Regatta regatta = getRegatta();
|
||||
if (regatta != null) {
|
||||
courseArea = regatta.getDefaultCourseArea();
|
||||
}
|
||||
return courseArea == null ? null : regatta.getDefaultCourseArea().getName();
|
||||
return HomeServiceUtil.getCourseAreaNameForRegattaIdThereIsMoreThanOne(event, leaderboard);
|
||||
}
|
||||
|
||||
private RaceProgressDTO getProgressOrNull() {
|
||||
|
||||
+2
@@ -37,4 +37,6 @@ public interface HasRegattaMetadata {
|
||||
Date getEndDate();
|
||||
|
||||
RegattaState getState();
|
||||
|
||||
String getDefaultCourseAreaName();
|
||||
}
|
||||
+9
@@ -9,6 +9,7 @@ public class RegattaMetadataDTO extends RegattaReferenceDTO implements HasRegatt
|
||||
private int trackedRacesCount;
|
||||
private String boatClass;
|
||||
private String boatCategory;
|
||||
private String defaultCourseAreaName;
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private RegattaState state;
|
||||
@@ -91,4 +92,12 @@ public class RegattaMetadataDTO extends RegattaReferenceDTO implements HasRegatt
|
||||
public void setState(RegattaState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getDefaultCourseAreaName() {
|
||||
return defaultCourseAreaName;
|
||||
}
|
||||
|
||||
public void setDefaultCourseAreaName(String defaultCourseAreaName) {
|
||||
this.defaultCourseAreaName = defaultCourseAreaName;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user