mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
Fix of bug 210 (Creation of leaderboards with already assigned names)
Conflicts: java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java
This commit is contained in:
1 parent
22e08c1b81
commit
de72ea6300
2 files changed
+9
-6
No files matched your search
+3
-6
@@ -211,7 +211,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
} else if ("ACTION_EDIT".equals(value)) {
|
||||
final String oldLeaderboardName = object.name;
|
||||
List<LeaderboardDTO> otherExistingLeaderboard = new ArrayList<LeaderboardDTO>();
|
||||
otherExistingLeaderboard.addAll(leaderboardList.getList());
|
||||
otherExistingLeaderboard.addAll(availableLeaderboardList);
|
||||
otherExistingLeaderboard.remove(object);
|
||||
LeaderboardEditDialog dialog = new LeaderboardEditDialog(Collections
|
||||
.unmodifiableCollection(otherExistingLeaderboard), object, stringMessages, errorReporter,
|
||||
@@ -783,11 +783,8 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
private void addNewLeaderboard() {
|
||||
List<String> leaderboardNames = new ArrayList<String>();
|
||||
for (LeaderboardDTO dao : leaderboardList.getList())
|
||||
leaderboardNames.add(dao.name);
|
||||
LeaderboardCreateDialog dialog = new LeaderboardCreateDialog(Collections.unmodifiableCollection(leaderboardList
|
||||
.getList()), stringMessages, errorReporter, new AsyncCallback<LeaderboardDTO>() {
|
||||
LeaderboardCreateDialog dialog = new LeaderboardCreateDialog(Collections.unmodifiableCollection(availableLeaderboardList)
|
||||
, stringMessages, errorReporter, new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable arg0) {
|
||||
}
|
||||
|
||||
+6
@@ -158,6 +158,9 @@ public class RacingEventServiceImpl implements RacingEventService, EventFetcher,
|
||||
Leaderboard result = new LeaderboardImpl(name, new ScoreCorrectionImpl(), new ResultDiscardingRuleImpl(
|
||||
discardThresholds));
|
||||
synchronized (leaderboardsByName) {
|
||||
if (leaderboardsByName.containsKey(name)) {
|
||||
throw new IllegalArgumentException("Leaderboard with name "+name+" already exists");
|
||||
}
|
||||
leaderboardsByName.put(name, result);
|
||||
}
|
||||
mongoObjectFactory.storeLeaderboard(result);
|
||||
@@ -693,6 +696,9 @@ public class RacingEventServiceImpl implements RacingEventService, EventFetcher,
|
||||
}
|
||||
LeaderboardGroup result = new LeaderboardGroupImpl(groupName, description, leaderboards);
|
||||
synchronized (leaderboardGroupsByName) {
|
||||
if (leaderboardGroupsByName.containsKey(groupName)) {
|
||||
throw new IllegalArgumentException("Leaderboard group with name " + groupName + " already exists");
|
||||
}
|
||||
leaderboardGroupsByName.put(groupName, result);
|
||||
}
|
||||
mongoObjectFactory.storeLeaderboardGroup(result);
|
||||
|
||||
Reference in new issue
Block a user