From c9d12e6cb250203b7dfc55d06495c070e357a480 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Fri, 6 Dec 2019 18:26:41 +1000 Subject: [PATCH] Inline getAnnotations function --- app/server/static/components/document_classification.vue | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/server/static/components/document_classification.vue b/app/server/static/components/document_classification.vue index 9f91311a..74b010c8 100644 --- a/app/server/static/components/document_classification.vue +++ b/app/server/static/components/document_classification.vue @@ -58,10 +58,6 @@ export default { mixins: [annotationMixin], methods: { - getAnnotation(label) { - return this.annotations[this.pageNumber].find(annotation => annotation.label === label.id); - }, - async submit() { const state = this.getState(); this.url = `docs?q=${this.searchQuery}&doc_annotations__isnull=${state}&offset=${this.offset}&ordering=${this.ordering}`; @@ -70,7 +66,9 @@ export default { }, async addLabel(label) { - const annotation = this.getAnnotation(label); + const annotations = this.annotations[this.pageNumber]; + const annotation = annotations.find(item => item.label === label.id); + if (annotation) { this.removeLabel(annotation); } else {