#108: avoid local add of already present person
This commit is contained in:
parent
a2a0ede8d6
commit
88fd3daf18
1 changed files with 7 additions and 0 deletions
7
angular_app/js/controllers.js
vendored
7
angular_app/js/controllers.js
vendored
|
@ -204,6 +204,13 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', '$state', 'Event',
|
||||||
if (!$scope.event.persons) {
|
if (!$scope.event.persons) {
|
||||||
$scope.event.persons = [];
|
$scope.event.persons = [];
|
||||||
}
|
}
|
||||||
|
var person_idx = $scope.event.persons.findIndex(function(el, idx, array) {
|
||||||
|
return person.person_id == el.person_id;
|
||||||
|
});
|
||||||
|
if (person_idx != -1) {
|
||||||
|
$log.debug('person already present: not added');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$scope.event.persons.push(person);
|
$scope.event.persons.push(person);
|
||||||
$scope.setPersonAttribute(person, 'attended', true, function() {
|
$scope.setPersonAttribute(person, 'attended', true, function() {
|
||||||
var all_person_idx = $scope.allPersons.findIndex(function(el, idx, array) {
|
var all_person_idx = $scope.allPersons.findIndex(function(el, idx, array) {
|
||||||
|
|
Loading…
Reference in a new issue