mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-22 20:13:52 +00:00
fix for bug 3681, "greening" the test: removing an overall leaderboard from the server unlinks it from the respective leaderboard group
Change-Id: Id23a781a2e640d8ee68d68e6dae2ec2e85b30a82
This commit is contained in:
1 parent
fecedb380a
commit
d1af28800d
1 file changed
+7
-4
+7
-4
@@ -1004,15 +1004,15 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks all groups, if they contain a leaderboard with the <code>removedLeaderboardName</code> and removes it from
|
||||
* the group.
|
||||
* Checks all groups, if they contain a leaderboard with the <code>removedLeaderboardName</code> or reference it as their
|
||||
* overall leaderboard and removes it from the group or unlinks it as the overall leaderboard, respectively.
|
||||
*
|
||||
* @param removedLeaderboardName
|
||||
*/
|
||||
private void syncGroupsAfterLeaderboardRemove(String removedLeaderboardName, boolean doDatabaseUpdate) {
|
||||
boolean groupNeedsUpdate = false;
|
||||
for (LeaderboardGroup leaderboardGroup : leaderboardGroupsByName.values()) {
|
||||
for (Leaderboard leaderboard : leaderboardGroup.getLeaderboards()) {
|
||||
for (final Leaderboard leaderboard : leaderboardGroup.getLeaderboards()) {
|
||||
if (leaderboard.getName().equals(removedLeaderboardName)) {
|
||||
leaderboardGroup.removeLeaderboard(leaderboard);
|
||||
groupNeedsUpdate = true;
|
||||
@@ -1020,7 +1020,10 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (leaderboardGroup.getOverallLeaderboard() != null && leaderboardGroup.getOverallLeaderboard().getName().equals(removedLeaderboardName)) {
|
||||
leaderboardGroup.setOverallLeaderboard(null);
|
||||
groupNeedsUpdate = true;
|
||||
}
|
||||
if (doDatabaseUpdate && groupNeedsUpdate) {
|
||||
mongoObjectFactory.storeLeaderboardGroup(leaderboardGroup);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user