Skip to content

Commit

Permalink
Support paginated list for job commits cvat-ai#4476 (cvat-ai#4482)
Browse files Browse the repository at this point in the history
* Support paginated list for job commits cvat-ai#4476

* Update CHANGELOG.md

Co-authored-by: Maria Khrustaleva <maria.khrustaleva@intel.com>

Co-authored-by: Maria Khrustaleva <maria.khrustaleva@intel.com>
  • Loading branch information
k1won and Maria Khrustaleva authored Mar 23, 2022
1 parent bceae22 commit 96af4f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Task annotations importing via chunk uploads (<https://github.com/openvinotoolkit/cvat/pull/4327>)
- Advanced filtration and sorting for a list of tasks/projects/cloudstorages (<https://github.com/openvinotoolkit/cvat/pull/4403>)
- Project dataset importing via chunk uploads (<https://github.com/openvinotoolkit/cvat/pull/4485>)
- Support paginated list for job commits (<https://github.com/openvinotoolkit/cvat/pull/4482>)

### Changed
- Added missing geos dependency into Dockerfile (<https://github.com/openvinotoolkit/cvat/pull/4451>)
Expand Down
10 changes: 7 additions & 3 deletions cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,10 +1176,14 @@ def data(self, request, pk):
@action(detail=True, methods=['GET'], serializer_class=JobCommitSerializer)
def commits(self, request, pk):
db_job = self.get_object()
queryset = db_job.commits
serializer = JobCommitSerializer(queryset,
context={'request': request}, many=True)
queryset = db_job.commits.order_by('-id')

page = self.paginate_queryset(queryset)
if page is not None:
serializer = JobCommitSerializer(page, context={'request': request}, many=True)
return self.get_paginated_response(serializer.data)

serializer = JobCommitSerializer(queryset, context={'request': request}, many=True)
return Response(serializer.data)

@extend_schema(tags=['issues'])
Expand Down

0 comments on commit 96af4f1

Please sign in to comment.