@@ -84,6 +84,19 @@ class Meta:
84
84
]
85
85
86
86
87
+ class ExampleSourceImageNestedSerializer (DefaultSerializer ):
88
+ class Meta :
89
+ model = SourceImage
90
+ fields = [
91
+ "id" ,
92
+ "details" ,
93
+ "url" ,
94
+ "width" ,
95
+ "height" ,
96
+ "timestamp" ,
97
+ ]
98
+
99
+
87
100
class DeviceNestedSerializer (DefaultSerializer ):
88
101
class Meta :
89
102
model = Device
@@ -252,8 +265,7 @@ class EventListSerializer(DefaultSerializer):
252
265
deployment = DeploymentNestedSerializer (
253
266
read_only = True ,
254
267
)
255
- example_captures = SourceImageNestedSerializer (many = True , read_only = True )
256
- # captures = serializers.StringRelatedField(many=True, read_only=True)
268
+ example_captures = ExampleSourceImageNestedSerializer (many = True , read_only = True )
257
269
captures = serializers .SerializerMethodField ()
258
270
259
271
class Meta :
@@ -1126,8 +1138,6 @@ class EventSerializer(DefaultSerializer):
1126
1138
start = serializers .DateTimeField (read_only = True )
1127
1139
end = serializers .DateTimeField (read_only = True )
1128
1140
capture_page_offset = serializers .SerializerMethodField ()
1129
- occurrences_count = serializers .SerializerMethodField ()
1130
- taxa_count = serializers .SerializerMethodField ()
1131
1141
1132
1142
class Meta :
1133
1143
model = Event
@@ -1210,18 +1220,6 @@ def get_capture_page_offset(self, obj) -> int | None:
1210
1220
1211
1221
return offset
1212
1222
1213
- def get_occurrences_count (self , obj ):
1214
- # This will display a count of the occurrences that are greater than the current classification threshold
1215
- # But this value will be different from the occurrences_count field, which is used for sorting & filtering
1216
- # @TODO refactor how the classification_threshold is used everywhere! delete it!
1217
- return obj .get_occurrences_count (
1218
- classification_threshold = get_active_classification_threshold (self .context ["request" ])
1219
- )
1220
-
1221
- def get_taxa_count (self , obj ):
1222
- # @TODO refactor how the classification_threshold is used everywhere! delete it!
1223
- return obj .taxa_count (classification_threshold = get_active_classification_threshold (self .context ["request" ]))
1224
-
1225
1223
1226
1224
class EventTimelineSourceImageSerializer (DefaultSerializer ):
1227
1225
class Meta :
0 commit comments