Skip to content

Commit db2ef92

Browse files
committed
Added annotation.feedback.internal_note
1 parent e9291ee commit db2ef92

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

api/serializers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,15 +655,20 @@ def to_representation(self, instance):
655655

656656
class AnnotationSerializer(serializers.ModelSerializer):
657657
class AnnotationFeedbackSerializer(serializers.ModelSerializer):
658+
def validate_internal_note(self, value):
659+
# tiger_certainty_notes can not be null, cast to blank.
660+
return value or ""
661+
658662
def validate_user_note(self, value):
659663
# message_for_user can not be null, cast to blank.
660664
return value or ""
661665

662666
def to_representation(self, instance):
663667
ret = super().to_representation(instance)
664668
# Ensure public_note and user_note will be None instead of blank
665-
ret['public_note'] = ret['public_note'] or None
666-
ret['user_note'] = ret['user_note'] or None
669+
ret['public_note'] = ret.get('public_note') or None
670+
ret['internal_note'] = ret.get('internal_note') or None
671+
ret['user_note'] = ret.get('user_note') or None
667672
return ret
668673

669674
class Meta:
@@ -674,6 +679,7 @@ class Meta:
674679
)
675680
extra_kwargs = {
676681
"public_note": {"source": "edited_user_notes", "allow_null": True},
682+
"internal_note": {"source": "tiger_certainty_notes", "allow_null": True},
677683
"user_note": {"source": "message_for_user", "allow_null": True},
678684
}
679685

api/tests/integration/identification_tasks/annotations/create.tavern.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ stages:
8787
is_high_confidence: true
8888
feedback:
8989
public_note: null
90+
internal_note: null
9091
user_note: null
9192
is_flagged: false
9293
is_decisive: false
@@ -148,6 +149,7 @@ stages:
148149
is_high_confidence: true
149150
feedback:
150151
public_note: null
152+
internal_note: null
151153
user_note: null
152154
is_flagged: false
153155
is_decisive: false

api/tests/integration/identification_tasks/annotations/schema.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ variables:
1515
full_name: !anystr
1616
best_photo: !anything
1717
classification: !anything
18-
feedback: !anything
18+
feedback:
19+
public_note: !anything
20+
internal_note: !anything
21+
user_note: !anything
1922
is_flagged: !anybool
2023
is_decisive: !anybool
2124
created_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z

0 commit comments

Comments
 (0)