fixed a problem adding the same org as suplicate
This commit is contained in:
parent
303e1433ac
commit
cc6e65138e
|
@ -217,6 +217,7 @@ public class DatabaseUtils {
|
|||
simrels.stream()
|
||||
.map(OpenaireDuplicate::getOaOriginalId)
|
||||
.filter(id -> id.startsWith(OpenOrgsConstants.OPENORGS_PENDING_PREFIX))
|
||||
.distinct()
|
||||
.forEach(organizationRepository::deleteById);
|
||||
|
||||
list.forEach(d -> {
|
||||
|
|
|
@ -251,6 +251,14 @@ orgsModule.directive('orgDuplicates', function($http, $location, $route) {
|
|||
scope.newDuplicate = {};
|
||||
|
||||
scope.addDuplicate = function() {
|
||||
|
||||
for (var i = 0; i < scope.duplicates.length; i++) {
|
||||
if (scope.duplicates[i].oaOriginalId == scope.newDuplicate.id) {
|
||||
alert("The selected organization has been already added !!!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
scope.duplicates.push({
|
||||
'localId' : scope.orgId,
|
||||
'oaOriginalId' : scope.newDuplicate.id,
|
||||
|
@ -263,6 +271,7 @@ orgsModule.directive('orgDuplicates', function($http, $location, $route) {
|
|||
'relType' : 'is_similar'
|
||||
});
|
||||
|
||||
// I find and copy the duplicates of the selected org
|
||||
call_http_get($http, 'api/organizations/duplicates?id=' + scope.newDuplicate.id, function(res) {
|
||||
angular.forEach(res.data, function(dup) {
|
||||
dup.localId = scope.orgId;
|
||||
|
|
Loading…
Reference in New Issue