diff --git a/app/api/views.py b/app/api/views.py
index 37a10c59..188a9b0f 100644
--- a/app/api/views.py
+++ b/app/api/views.py
@@ -374,9 +374,15 @@ class TextDownloadAPI(APIView):
def get(self, request, *args, **kwargs):
format = request.query_params.get('q')
+ only_approved = request.query_params.get('onlyApproved')
project = get_object_or_404(Project, pk=self.kwargs['project_id'])
- documents = project.documents.all()
+ documents = (
+ project.documents.exclude(annotations_approved_by = None)
+ if only_approved == 'true'
+ else project.documents.all()
+ )
painter = self.select_painter(format)
+
# jsonl-textlabel format prints text labels while jsonl format prints annotations with label ids
# jsonl-textlabel format - "labels": [[0, 15, "PERSON"], ..]
# jsonl format - "annotations": [{"label": 5, "start_offset": 0, "end_offset": 2, "user": 1},..]
diff --git a/frontend/components/organisms/documents/DocumentExportForm.vue b/frontend/components/organisms/documents/DocumentExportForm.vue
index 6c889989..a3c96ad1 100644
--- a/frontend/components/organisms/documents/DocumentExportForm.vue
+++ b/frontend/components/organisms/documents/DocumentExportForm.vue
@@ -37,6 +37,12 @@
{{ $t('dataset.exportDataMessage2') }}
+
@@ -68,6 +74,7 @@ export default {
file: null,
selectedFormat: null,
selectedFileName: 'project_' + this.$route.params.id + '_dataset',
+ onlyApproved: false,
fileFormatRules,
uploadFileRules
}
@@ -99,6 +106,7 @@ export default {
projectId: this.$route.params.id,
fileName: this.selectedFileName,
format: this.selectedFormat.type,
+ onlyApproved: this.onlyApproved,
suffix: this.selectedFormat.suffix
})
this.reset()
diff --git a/frontend/services/document.service.js b/frontend/services/document.service.js
index e73b1a60..efe1c0af 100644
--- a/frontend/services/document.service.js
+++ b/frontend/services/document.service.js
@@ -29,7 +29,7 @@ class DocumentService {
return this.request.post(`/projects/${projectId}/docs/upload`, payload, config)
}
- exportFile(projectId, format) {
+ exportFile(projectId, format, onlyApproved) {
const headers = {}
if (format === 'csv') {
headers.Accept = 'text/csv; charset=utf-8'
@@ -41,7 +41,8 @@ class DocumentService {
const config = {
responseType: 'blob',
params: {
- q: format
+ q: format,
+ onlyApproved
},
headers
}
diff --git a/frontend/store/documents.js b/frontend/store/documents.js
index d0e6b2de..287e7d56 100644
--- a/frontend/store/documents.js
+++ b/frontend/store/documents.js
@@ -122,7 +122,7 @@ export const actions = {
},
exportDocument({ commit }, data) {
commit('setLoading', true)
- DocumentService.exportFile(data.projectId, data.format)
+ DocumentService.exportFile(data.projectId, data.format, data.onlyApproved)
.then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')