Skip to content

Commit

Permalink
add a try/except to return None if the text does not exist while inde…
Browse files Browse the repository at this point in the history
…xing QA logs
  • Loading branch information
helllllllder committed Oct 21, 2021
1 parent 268accc commit 2080487
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bothub/common/documents/repositoryqanlplog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2080487

Please sign in to comment.