Skip to content

Commit

Permalink
Fix order (#4087)
Browse files Browse the repository at this point in the history
* Fix order

* Update header

* Update changelog

* Add Prefetch

Co-authored-by: Nikita Manovich <nikita.manovich@intel.com>
  • Loading branch information
Marishka17 and Nikita Manovich authored Jan 11, 2022
1 parent 59f0b3b commit 297a9cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added information to export CVAT_HOST when performing local installation for accessing over network (<https://github.com/openvinotoolkit/cvat/pull/4014>)
- Fixed possible color collisions in the generated colormap (<https://github.com/openvinotoolkit/cvat/pull/4007>)
- Original pdf file is deleted when using share (<https://github.com/openvinotoolkit/cvat/pull/3967>)
- Order in an annotation file(<https://github.com/openvinotoolkit/cvat/pull/4087>)
- Fixed task data upload progressbar (<https://github.com/openvinotoolkit/cvat/pull/4134>)

### Security
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/dataset_manager/bindings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2019-2020 Intel Corporation
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

Expand Down
5 changes: 4 additions & 1 deletion cvat/apps/dataset_manager/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from enum import Enum

from django.db import transaction
from django.db.models.query import Prefetch
from django.utils import timezone

from cvat.apps.engine import models, serializers
Expand Down Expand Up @@ -547,7 +548,9 @@ def import_annotations(self, src_file, importer):

class TaskAnnotation:
def __init__(self, pk):
self.db_task = models.Task.objects.prefetch_related("data__images").get(id=pk)
self.db_task = models.Task.objects.prefetch_related(
Prefetch('data__images', queryset=models.Image.objects.order_by('frame'))
).get(id=pk)

# Postgres doesn't guarantee an order by default without explicit order_by
self.db_jobs = models.Job.objects.select_related("segment").filter(segment__task_id=pk).order_by('id')
Expand Down

0 comments on commit 297a9cc

Please sign in to comment.