Refactor annotation tools and implement quality choice annotation feature
- Updated the annotation label from "bewertet" to "annotiert" in the HomePage component. - Removed the SingleChoiceView component and replaced it with a new QualityChoiceEntryView component for handling quality choice annotations. - Introduced QualityChoiceView component to manage the flow of quality choice annotations, including navigation and progress tracking. - Updated EditableExperimentHeader to default to 'quality-choice' annotation tool. - Added unique index for annotations in the database schema to prevent duplicate entries. - Enhanced WaveformPlayer to support audio playback state management.
This commit is contained in:
@@ -66,7 +66,7 @@ export async function getAnnotationEntries(experimentId: number): Promise<Datase
|
||||
|
||||
/**
|
||||
* Persists a batch of ratings for the authenticated user.
|
||||
* Silently ignores duplicates (onConflictDoNothing).
|
||||
* Updates existing annotations with the same userId, experimentId, and datasetEntryId.
|
||||
*/
|
||||
export async function saveAnnotations(
|
||||
ratings: { entryId: number; rating: number; dialectLabel: string }[],
|
||||
@@ -81,7 +81,13 @@ export async function saveAnnotations(
|
||||
await db
|
||||
.insert(annotation)
|
||||
.values({experimentId, datasetEntryId: entryId, userId: session.user.id, rating, dialectLabel })
|
||||
.onConflictDoNothing();
|
||||
.onConflictDoUpdate({
|
||||
target: [annotation.userId, annotation.experimentId, annotation.datasetEntryId],
|
||||
set: {
|
||||
rating,
|
||||
dialectLabel,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user