Browse Source

Remove unneeded query

Bulk create returns the created objects in the same order as they have been added.

In Postgres, the query was wrong, because ordering was not guaranteed.
pull/1442/head
Roland Szabo 4 years ago
parent
commit
0243c73462
1 changed files with 2 additions and 4 deletions
  1. 6
      backend/api/tasks.py

6
backend/api/tasks.py

@ -62,10 +62,8 @@ class DataFactory:
self.data_class(project=project, **example.data)
for example in examples
]
now = datetime.datetime.now()
self.data_class.objects.bulk_create(dataset)
ids = self.data_class.objects.filter(created_at__gte=now)
return list(ids)
results = self.data_class.objects.bulk_create(dataset)
return results
def create_annotation(self, examples, ids, user, project):
mapping = {label.text: label.id for label in project.labels.all()}

Loading…
Cancel
Save