Skip to content

Commit

Permalink
#3287: base_data.py, remove 'unorderable types' error
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff1evesque committed Oct 10, 2018
1 parent 950f10e commit 05ab4b9
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion brain/session/base_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def save_premodel_dataset(self):
if (
not self.uid and
collection_count and
collection_count['result'] and
collection_count['result'] >= self.max_collection and
collection_adjusted
):
Expand All @@ -106,7 +107,10 @@ def save_premodel_dataset(self):
collection_count = entity.get_collection_count(self.uid)
document_count = cursor.query(collection_adjusted, 'count_documents')

# save dataset
#
# save dataset: 'elif' case introduced since python3 does not support
# comparison against 'None'.
#
if (
collection_adjusted and
collection_count and
Expand All @@ -129,6 +133,27 @@ def save_premodel_dataset(self):
document
)

elif (
collection_adjusted and
collection_count and
document_count and
(not collection_count['result'] or not document_count['result'])
):
current_utc = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
self.premodel_data['properties']['datetime_saved'] = current_utc

if self.dataset:
document = {
'properties': self.premodel_data['properties'],
'dataset': self.dataset
}

response = cursor.query(
collection_adjusted,
'insert_one',
document
)

else:
response = None

Expand Down

0 comments on commit 05ab4b9

Please sign in to comment.