Skip to content

Commit

Permalink
Refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed May 16, 2024
1 parent 79e29bb commit 7e2ec85
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cvat/apps/engine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,12 @@ def create(self, validated_data):
return job

def update(self, instance, validated_data):
state = validated_data.get('state', instance.state)
stage = validated_data.get('stage', instance.stage)
if 'stage' in validated_data or 'state' in validated_data:
state = validated_data.get('state')
stage = validated_data.get('stage')
if stage or state:
stage = stage or instance.stage
state = state or instance.state

if stage == models.StageChoice.ANNOTATION:
status = models.StatusChoice.ANNOTATION
elif stage == models.StageChoice.ACCEPTANCE and state == models.StateChoice.COMPLETED:
Expand Down

0 comments on commit 7e2ec85

Please sign in to comment.