From 2080487086e1b980b6c835d274408edd09324bf3 Mon Sep 17 00:00:00 2001 From: helllllllder Date: Thu, 21 Oct 2021 11:09:46 -0300 Subject: [PATCH] add a try/except to return None if the text does not exist while indexing QA logs --- bothub/common/documents/repositoryqanlplog.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bothub/common/documents/repositoryqanlplog.py b/bothub/common/documents/repositoryqanlplog.py index e85bbcf7..3d41b918 100644 --- a/bothub/common/documents/repositoryqanlplog.py +++ b/bothub/common/documents/repositoryqanlplog.py @@ -44,7 +44,10 @@ class Django: ] def prepare_text(self, obj): - return obj.knowledge_base.texts.filter(language=obj.language).first().id + try: + return obj.knowledge_base.texts.filter(language=obj.language).first().id + except AttributeError: + return None def prepare_nlp_log(self, obj): return json.loads(obj.nlp_log)