From 830fdc42e8f8464ee808059968d4f768a11392bd Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 11 Jun 2018 11:57:11 +0900 Subject: [PATCH] Update progress --- doccano/app/db.sqlite3 | Bin 184320 -> 184320 bytes doccano/app/server/static/annotation.js | 9 +++++++++ doccano/app/server/static/project_admin.js | 13 +++++++++++++ doccano/app/server/urls.py | 4 ++-- doccano/app/server/views.py | 11 ++++++----- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/doccano/app/db.sqlite3 b/doccano/app/db.sqlite3 index 26bddf1c0da7cbb178d1fbe989e5d061b80a91bf..3eae58d5768e4ac2a2b4fec72398e3e899565e13 100644 GIT binary patch delta 934 zcmZ{i-%C?r7{}jVv%PcenPNZG%%e6)(rstk*>RIFE9xpTs4Ee7+)itv=g2mLGE3+_ ziV?d^Z|pj}@ItV^p@_1J97sZjqO3AVFM7|JLki>^-j{Qp@AEy+=RMz<+1i=e+ULz! zeR1XrR^KG%TTgNV8^B=+?!aSs38N5$*U-AqCT)3|8wl;jsZq^Ho5NaaJYx)xnQ3;q zjw-nL?iFchqzym=&YYgTuV;rf!!Yw&K4Tj2tZ*yPf_cFVNL?S$F`m=CZtBAa!ZB?` zA0zc%+F5-wku^v4WS$n50*wqIbmHksU~wgYyC&QWHjtQb4}QV+LS5oB6b4GH!^s>J zV;8ko!YJl0m*``#gb73VO4Ej|i6jPN;LOLw_(%>ahd)fZxofH6!!T4z6j1h{BE)qFvY#U2AsUny8&L zLMY|Dq7ebIgC;azq3JMTRRw`v+eOsB+aBIZxAj9Xi0-ned;^bL%-X{9dM+=e%;fw8 GN&E%Q*X{)X delta 339 zcmZozz}>KbdxA8h(L@<%Mx%`h%jCrrnD}4vU*X@)AIe|H-^ZWDZ^^%cUtzPN0SiB? zxFEAB=k$y7nM5Q+_?h)Nic^cqQj6jf^YZdb5=%1k^Z4ga4%C-r@K4`&pV4hQ zO99g#{z(Na=*F;ca&q#5jakURzYwTlI{);A{7lI}b-x(+e}T/apis/data', AnnotationAPIView.as_view()), path('/apis/raw_data', RawDataAPI.as_view(), name='data_api'), path('/apis/labels', LabelAPI.as_view(), name='label_api'), - path('/apis/label', MetaInfoAPI.as_view()), + path('/apis/progress', ProgressAPI.as_view()), path('/apis/search', SearchAPI.as_view()), ] diff --git a/doccano/app/server/views.py b/doccano/app/server/views.py index 51ceac01..a4a33e35 100644 --- a/doccano/app/server/views.py +++ b/doccano/app/server/views.py @@ -56,11 +56,14 @@ class AnnotationAPIView(View): return JsonResponse({}) -class MetaInfoAPI(View): +class ProgressAPI(View): def get(self, request, *args, **kwargs): - total = Document.objects.count() - remaining = Document.objects.filter(annotation__isnull=True).count() + project_id = kwargs.get('project_id') + project = Project.objects.get(id=project_id) + docs = Document.objects.filter(project=project) + total = docs.count() + remaining = docs.filter(annotation__isnull=True).count() return JsonResponse({'total': total, 'remaining': remaining}) @@ -71,8 +74,6 @@ class SearchAPI(View): keyword = request.GET.get('keyword') docs = Document.objects.filter(text__contains=keyword) labels = [[a.as_dict() for a in Annotation.objects.filter(data=d.id)] for d in docs] - # print(annotations) - # print(docs) docs = [{**d.as_dict(), **{'labels': []}} for d in docs] # Annotation.objects.select_related('data').all().filter(data__text__contains=keyword)