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 migration 0015 for tasks that have no segments (in case of creating task process was terminated for example) #416

Merged
merged 1 commit into from
Apr 22, 2019
Merged
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
5 changes: 3 additions & 2 deletions cvat/apps/engine/migrations/0015_db_redesign_20190217.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ def set_segment_size(apps, schema_editor):
Task = apps.get_model('engine', 'Task')
for task in Task.objects.all():
segment = task.segment_set.first()
task.segment_size = segment.stop_frame - segment.start_frame + 1
task.save()
if segment:
task.segment_size = segment.stop_frame - segment.start_frame + 1
task.save()

class Migration(migrations.Migration):

Expand Down