Merge pull request #115 from alberanid/master

fix persons import
This commit is contained in:
Davide Alberani 2016-04-25 14:40:18 +02:00
commit 1b1efb88cf

View file

@ -416,16 +416,16 @@ class EventsHandler(CollectionHandler):
data['seq_hex'] = '%06X' % data['seq'] data['seq_hex'] = '%06X' % data['seq']
doc = self.db.query('events', doc = self.db.query('events',
{'_id': id_, 'persons.person_id': person_id}) {'_id': id_, 'persons.person_id': person_id})
ret = {'action': 'add', 'person_id': person_id, 'person': data, 'uuid': uuid}
if '_id' in data: if '_id' in data:
del data['_id'] del data['_id']
ret = {'action': 'add', 'person_id': person_id, 'person': data, 'uuid': uuid} self.send_ws_message('event/%s/updates' % id_, json.dumps(ret))
if not doc: if not doc:
merged, doc = self.db.update('events', merged, doc = self.db.update('events',
{'_id': id_}, {'_id': id_},
{'persons': data}, {'persons': data},
operation='appendUnique', operation='appendUnique',
create=False) create=False)
self.send_ws_message('event/%s/updates' % id_, json.dumps(ret))
return ret return ret
def handle_put_persons(self, id_, person_id, data): def handle_put_persons(self, id_, person_id, data):