From 4e0228753e0417806e6b7dc3354b6deeda583a2d Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Thu, 26 Jan 2017 23:10:52 +0100 Subject: [PATCH] fixes #7: improve collection selector --- ibt2.py | 14 ++++++++++++-- src/App.vue | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ibt2.py b/ibt2.py index 674bc51..d8ca594 100755 --- a/ibt2.py +++ b/ibt2.py @@ -330,7 +330,11 @@ class DaysHandler(BaseHandler): now = datetime.datetime.now() data['updated_by'] = self.current_user_info.get('_id') 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) @@ -342,7 +346,13 @@ class GroupsHandler(BaseHandler): now = datetime.datetime.now() data['updated_by'] = self.current_user_info.get('_id') 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) diff --git a/src/App.vue b/src/App.vue index 5559112..37633e9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -178,6 +178,7 @@ export default { this.$refs.dialogObj.show({text: 'unable to edit day notes'}); }).then((json) => { this.day.notes = json.notes; + this.reload(); }); } },