fixes #7: improve collection selector

This commit is contained in:
Davide Alberani 2017-01-26 23:10:52 +01:00
parent 4f77b3953d
commit 4e0228753e
2 changed files with 13 additions and 2 deletions

14
ibt2.py
View file

@ -330,7 +330,11 @@ class DaysHandler(BaseHandler):
now = datetime.datetime.now() now = datetime.datetime.now()
data['updated_by'] = self.current_user_info.get('_id') data['updated_by'] = self.current_user_info.get('_id')
data['updated_at'] = now data['updated_at'] = now
merged, doc = self.db.update('days', self.arguments, data) day = (data.get('day') or '').strip()
if not day:
return self.build_error(status=404, message='unable to access the resource')
data['day'] = day
merged, doc = self.db.update('days', {'day': day}, data)
self.write(doc) self.write(doc)
@ -342,7 +346,13 @@ class GroupsHandler(BaseHandler):
now = datetime.datetime.now() now = datetime.datetime.now()
data['updated_by'] = self.current_user_info.get('_id') data['updated_by'] = self.current_user_info.get('_id')
data['updated_at'] = now data['updated_at'] = now
merged, doc = self.db.update('groups', self.arguments, data) day = (data.get('day') or '').strip()
group = (data.get('group') or '').strip()
if not (day and group):
return self.build_error(status=404, message='unable to access the resource')
data['day'] = day
data['group'] = group
merged, doc = self.db.update('groups', {'day': day, 'group': group}, data)
self.write(doc) self.write(doc)

View file

@ -178,6 +178,7 @@ export default {
this.$refs.dialogObj.show({text: 'unable to edit day notes'}); this.$refs.dialogObj.show({text: 'unable to edit day notes'});
}).then((json) => { }).then((json) => {
this.day.notes = json.notes; this.day.notes = json.notes;
this.reload();
}); });
} }
}, },