Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed updating job/task status after changing job state #7901

Merged
merged 6 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/20240516_144912_boris_fixed_job_status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Job's/task's status are not updated when job's state updated to completed and stage is already acceptance
(<https://github.com/cvat-ai/cvat/pull/7901>)
18 changes: 9 additions & 9 deletions cvat/apps/engine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,19 +748,19 @@ def create(self, validated_data):
return job

def update(self, instance, validated_data):
state = validated_data.get('state')
stage = validated_data.get('stage')
if stage:
stage = validated_data.get('stage', instance.stage)
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
state = validated_data.get('state', models.StateChoice.NEW if stage != instance.stage else instance.state)

if 'stage' in validated_data or 'state' in validated_data:
if stage == models.StageChoice.ANNOTATION:
status = models.StatusChoice.ANNOTATION
validated_data['status'] = models.StatusChoice.ANNOTATION
elif stage == models.StageChoice.ACCEPTANCE and state == models.StateChoice.COMPLETED:
status = models.StatusChoice.COMPLETED
validated_data['status'] = models.StatusChoice.COMPLETED
else:
status = models.StatusChoice.VALIDATION
validated_data['status'] = models.StatusChoice.VALIDATION

validated_data['status'] = status
if stage != instance.stage and not state:
validated_data['state'] = models.StateChoice.NEW
if state != instance.state:
validated_data['state'] = state
bsekachev marked this conversation as resolved.
Show resolved Hide resolved

assignee = validated_data.get('assignee')
if assignee is not None:
Expand Down
Loading