Skip to content
Snippets Groups Projects
Commit f8430ac1 authored by Jakob Dieterle's avatar Jakob Dieterle Committed by Dominik Seeger
Browse files

Resolve "re-submit fails with label only"

parent 9aab5df0
Branches
Tags
1 merge request!220Resolve "re-submit fails with label only"
Pipeline #119418 passed
...@@ -160,11 +160,16 @@ class FeedbackSerializer(DynamicFieldsModelSerializer): ...@@ -160,11 +160,16 @@ class FeedbackSerializer(DynamicFieldsModelSerializer):
self.instance is not None and self.instance is not None and
self.instance.feedback_lines.count() > 0) self.instance.feedback_lines.count() > 0)
has_label_attached = 'labels' in data and len(data['labels']) > 0 has_label_attached = ('labels' in data and len(data['labels']) > 0 or
self.instance is not None and
self.instance.labels.count() > 0)
labels_get_deleted = 'labels' in data and len(data['labels']) == 0
# a non-full scored feedback is considered valid if there is # a non-full scored feedback is considered valid if there is
# at least one comment line or a label attached to the feedback # at least one comment line or a label attached to the feedback
if not (has_full_score or has_feedback_lines or has_label_attached): if not (has_full_score or has_feedback_lines or
(has_label_attached and not labels_get_deleted)):
raise serializers.ValidationError( raise serializers.ValidationError(
'Sorry, you have to explain why this does not get full score') 'Sorry, you have to explain why this does not get full score')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment