fix more than 1 task assigned to a check for agents on 0.10.2 or lower

This commit is contained in:
wh1te909 2020-08-26 20:37:08 +00:00
parent d17e9bf721
commit 27239a87c1
1 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,9 @@ class CheckRunnerGetSerializer(serializers.ModelSerializer):
def get_assigned_task(self, obj):
if obj.assignedtask.exists():
task = obj.assignedtask.get()
# this will not break agents on version 0.10.2 or lower
# newer agents once released will properly handle multiple tasks assigned to a check
task = obj.assignedtask.first()
return AssignedTaskCheckRunnerField(task).data
class Meta: