add protection for error document

This commit is contained in:
2022-03-05 23:46:24 +01:00
parent c512dd65a3
commit b748cfcf6a
+3 -2
View File
@@ -62,8 +62,9 @@ class DataManager:
doc_ref = self._db.collection(document_name).document(result.id) doc_ref = self._db.collection(document_name).document(result.id)
doc_ref.set(result.to_firestore_dict()) doc_ref.set(result.to_firestore_dict())
else: else:
doc_ref = self._db.collection(ERROR_COLLECTION_NAME).document(result.phone) if len(result.phone) > 0:
doc_ref.set(result.to_firestore_dict()) doc_ref = self._db.collection(ERROR_COLLECTION_NAME).document(result.phone)
doc_ref.set(result.to_firestore_dict())
def save_timeout_contact(self, contact: ContactPojo): def save_timeout_contact(self, contact: ContactPojo):
doc_ref = self._db.collection(TIMEOUT).document(str(contact.phone)) doc_ref = self._db.collection(TIMEOUT).document(str(contact.phone))