mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 06:17:27 +00:00
Added method to traverse all leaderboards of an event
This commit is contained in:
1 parent
28a8517bdd
commit
8f5619c7ea
2 files changed
+32
No files matched your search
+13
@@ -30,6 +30,10 @@ public final class EventActionUtil {
|
||||
void doForRace(RaceContext context);
|
||||
}
|
||||
|
||||
protected interface LeaderboardCallback {
|
||||
void doForLeaderboard(LeaderboardContext context);
|
||||
}
|
||||
|
||||
public static <T extends DTO> ResultWithTTL<T> withLiveRaceOrDefaultSchedule(DispatchContext context, UUID eventId, CalculationWithEvent<T> callback) {
|
||||
Event event = context.getRacingEventService().getEvent(eventId);
|
||||
EventState eventState = HomeServiceUtil.calculateEventState(event);
|
||||
@@ -60,6 +64,15 @@ public final class EventActionUtil {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void forLeaderboardsOfEvent(DispatchContext context, UUID eventId, LeaderboardCallback callback) {
|
||||
Event event = context.getRacingEventService().getEvent(eventId);
|
||||
for (LeaderboardGroup lg : event.getLeaderboardGroups()) {
|
||||
for (Leaderboard leaderboard : lg.getLeaderboards()) {
|
||||
callback.doForLeaderboard(new LeaderboardContext(event, leaderboard));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void forRacesOfEvent(DispatchContext context, UUID eventId, RaceCallback callback) {
|
||||
Event event = context.getRacingEventService().getEvent(eventId);
|
||||
for (LeaderboardGroup lg : event.getLeaderboardGroups()) {
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.sap.sailing.gwt.ui.shared.dispatch.event;
|
||||
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.RaceColumn;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.DispatchContext;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.EventActionUtil.RaceCallback;
|
||||
|
||||
public class LeaderboardContext {
|
||||
|
||||
private final Event event;
|
||||
private final Leaderboard leaderboard;
|
||||
|
||||
public LeaderboardContext(Event event, Leaderboard leaderboard) {
|
||||
this.event = event;
|
||||
this.leaderboard = leaderboard;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user