check before adding a new registered person to an event
This commit is contained in:
parent
41117bf967
commit
c5574f0b4c
2 changed files with 8 additions and 6 deletions
|
@ -41,7 +41,7 @@
|
|||
<body>
|
||||
<nav class="navbar navbar-default navbar-fixed-top" ng-controller="NavigationCtrl as n">
|
||||
<div class="container">
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li ng-class="{active: n.isActive('/events') || n.isActive('/event')}"><a ui-sref="events">{{'Events' | translate}}</a></li>
|
||||
<li ng-class="{active: n.isActive('/persons') || n.isActive('/person') || n.isActive('/import/persons')}"><a ui-sref="persons">{{'Persons' | translate}}</a></li>
|
||||
|
|
|
@ -154,11 +154,13 @@ class EventsHandler(CollectionHandler):
|
|||
return {'persons': event.get('persons') or {}}
|
||||
|
||||
def handle_post_persons(self, id_, person_id, data):
|
||||
merged, doc = self.db.update('events',
|
||||
{'_id': id_},
|
||||
{'persons': data},
|
||||
operator='$push',
|
||||
create=False)
|
||||
if not self.db.query('events',
|
||||
{'_id': id_, 'persons.person_id': person_id}):
|
||||
merged, doc = self.db.update('events',
|
||||
{'_id': id_},
|
||||
{'persons': data},
|
||||
operator='$push',
|
||||
create=False)
|
||||
return {'event': doc}
|
||||
|
||||
def handle_put_persons(self, id_, person_id, data):
|
||||
|
|
Loading…
Reference in a new issue