mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-12 05:35:31 +00:00
filter statistics based on permission in event overview
This commit is contained in:
1 parent
c656de76ae
commit
dcf03efeb6
1 file changed
+21
-13
+21
-13
@@ -4155,20 +4155,28 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
public Map<Integer, Statistics> getLocalStatisticsByYear() {
|
||||
final Map<Integer, StatisticsCalculator> calculators = new HashMap<>();
|
||||
getAllEvents().forEach((event) -> {
|
||||
final Integer eventYear = EventUtil.getYearOfEvent(event);
|
||||
// The year may be null if the event has no start date set
|
||||
// In this case the event is ignored for the yearly
|
||||
if (eventYear != null) {
|
||||
final StatisticsCalculator calculator;
|
||||
if (calculators.containsKey(eventYear)) {
|
||||
calculator = calculators.get(eventYear);
|
||||
} else {
|
||||
calculator = new StatisticsCalculator(trackedRaceStatisticsCache);
|
||||
calculators.put(eventYear, calculator);
|
||||
if (getSecurityService().hasCurrentUserReadPermission(event)) {
|
||||
final Integer eventYear = EventUtil.getYearOfEvent(event);
|
||||
// The year may be null if the event has no start date set
|
||||
// In this case the event is ignored for the yearly
|
||||
if (eventYear != null) {
|
||||
final StatisticsCalculator calculator;
|
||||
if (calculators.containsKey(eventYear)) {
|
||||
calculator = calculators.get(eventYear);
|
||||
} else {
|
||||
calculator = new StatisticsCalculator(trackedRaceStatisticsCache);
|
||||
calculators.put(eventYear, calculator);
|
||||
}
|
||||
event.getLeaderboardGroups().forEach((lg) -> {
|
||||
if (getSecurityService().hasCurrentUserReadPermission(lg)) {
|
||||
lg.getLeaderboards().forEach(t -> {
|
||||
if (getSecurityService().hasCurrentUserReadPermission(t)) {
|
||||
calculator.addLeaderboard(t);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
event.getLeaderboardGroups().forEach((lg) -> {
|
||||
lg.getLeaderboards().forEach(calculator::addLeaderboard);
|
||||
});
|
||||
}
|
||||
});
|
||||
Map<Integer, Statistics> result = new HashMap<>();
|
||||
|
||||
Reference in new issue
Block a user