Browse Source

Update progress API

pull/10/head
Hironsan 6 years ago
parent
commit
a190a50c12
1 changed files with 8 additions and 1 deletions
  1. 9
      app/server/views.py

9
app/server/views.py

@ -88,7 +88,14 @@ class ProjectViewSet(viewsets.ModelViewSet):
def progress(self, request, pk=None):
project = self.get_object()
docs = project.documents.all()
remaining = docs.filter(doc_annotations__isnull=True).count()
if project.is_type_of(Project.DOCUMENT_CLASSIFICATION):
remaining = docs.filter(doc_annotations__isnull=True).count()
elif project.is_type_of(Project.SEQUENCE_LABELING):
remaining = docs.filter(seq_annotations__isnull=True).count()
elif project.is_type_of(Project.Seq2seq):
remaining = docs.filter(seq2seq_annotations__isnull=True).count()
else:
remaining = 0
return Response({'total': docs.count(), 'remaining': remaining})

Loading…
Cancel
Save