From e5344d69ed02a987bb22721e861b082253f4d9a7 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Wed, 21 Apr 2021 08:17:38 +0900 Subject: [PATCH] Enable to export a doc without label --- app/api/views/download/repositories.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/api/views/download/repositories.py b/app/api/views/download/repositories.py index e4ccbef4..3568a9f4 100644 --- a/app/api/views/download/repositories.py +++ b/app/api/views/download/repositories.py @@ -40,6 +40,20 @@ class TextRepository(BaseRepository): user=user, metadata=doc.meta ) + # todo: + # If there is no label, export the doc with `unknown` user. + # This is a quick solution. + # In the future, the doc without label will be exported + # with the user who approved the doc. + # This means I will allow each user to be able to approve the doc. + if len(label_per_user): + yield Record( + id=doc.id, + data=doc.text, + label=[], + user='unknown', + metadata={} + ) @abc.abstractmethod def label_per_user(self, doc) -> Dict: