Browse Source

Enable to export a doc without label

pull/1310/head
Hironsan 3 years ago
parent
commit
e5344d69ed
1 changed files with 14 additions and 0 deletions
  1. 14
      app/api/views/download/repositories.py

14
app/api/views/download/repositories.py

@ -40,6 +40,20 @@ class TextRepository(BaseRepository):
user=user, user=user,
metadata=doc.meta 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 @abc.abstractmethod
def label_per_user(self, doc) -> Dict: def label_per_user(self, doc) -> Dict:

Loading…
Cancel
Save