Skip to content

Commit 8d0c6c4

Browse files
committed
Sort annotations in the API request, not in the code
1 parent e5cc741 commit 8d0c6c4

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/views/identification_task/DetailView.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@
105105
:review="identificationTask?.review" />
106106
</div>
107107
<div class="flex flex-col items-center gap-2">
108-
<span v-if="sortedAnnotations.length === 0" class="text-lg text-gray-600 dark:text-gray-400">
108+
<span v-if="annotations.length === 0" class="text-lg text-gray-600 dark:text-gray-400">
109109
No annotations given for this identification task.
110110
</span>
111-
<AnnotationPanel v-for="annotation in sortedAnnotations" :key="annotation.id" :annotation="annotation"
111+
<AnnotationPanel v-for="annotation in annotations" :key="annotation.id" :annotation="annotation"
112112
:collapsed="!(annotation.feedback?.public_note || annotation.feedback?.internal_note)" class="w-full" />
113113
</div>
114114
</div>
@@ -185,7 +185,7 @@ import { useToast } from "primevue/usetoast";
185185
import { identificationTasksApi } from '@/services/apiService';
186186
import { useUserStore } from '@/stores/userStore';
187187
import type { IdentificationTask, SimplePhoto, Annotation, PhotoPrediction, IdentificationTasksApiReviewCreateRequest, CreateAgreeReviewRequest, CreateOverwriteReviewRequest, MetaCreateIdentificationTaskReviewRequest, SimpleTaxon } from 'mosquito-alert';
188-
import { AnnotationClassificationConfidenceLabel, CreateAgreeReviewRequestAction, CreateOverwriteReviewRequestAction, IdentificationTaskResultSource } from 'mosquito-alert';
188+
import { AnnotationClassificationConfidenceLabel, CreateAgreeReviewRequestAction, CreateOverwriteReviewRequestAction, IdentificationTaskResultSource, IdentificationtasksListOrderByParameter } from 'mosquito-alert';
189189
190190
import { formatLocalDateTime } from '@/utils/DateUtils';
191191
@@ -246,12 +246,6 @@ watch(identificationTask, () => {
246246
fetchPhotoPredictions();
247247
})
248248
249-
const sortedAnnotations = computed(() =>
250-
[...annotations.value].sort(
251-
(a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
252-
)
253-
)
254-
255249
const userHasAnnotated = computed(() => {
256250
return annotations.value.some(annotation => annotation.user.uuid === userStore.user!.uuid);
257251
})
@@ -308,7 +302,7 @@ function fetchIdentificationTask() {
308302
309303
function fetchAnnotations() {
310304
loading.value = true;
311-
identificationTasksApi.annotationsList({ observationUuid: props.observationUuid }).then(
305+
identificationTasksApi.annotationsList({ observationUuid: props.observationUuid, orderBy: [IdentificationtasksListOrderByParameter.CreatedAt,] }).then(
312306
(response) => {
313307
annotations.value = response.data.results || [];
314308
loading.value = false;

0 commit comments

Comments
 (0)