diff --git a/backend/src/main/java/org/raddatz/familienarchiv/repository/TranscriptionBlockRepository.java b/backend/src/main/java/org/raddatz/familienarchiv/repository/TranscriptionBlockRepository.java index 8e61e09d..5c2d34e2 100644 --- a/backend/src/main/java/org/raddatz/familienarchiv/repository/TranscriptionBlockRepository.java +++ b/backend/src/main/java/org/raddatz/familienarchiv/repository/TranscriptionBlockRepository.java @@ -60,6 +60,8 @@ public interface TranscriptionBlockRepository extends JpaRepository findSegmentationBlocks(); + // Uses 'KURRENT_RECOGNITION' MEMBER OF d.trainingLabels — aligned with findEligibleKurrentBlocks() + // which already used this form (changed from d.scriptType = 'KURRENT' in the original queries). @Query(""" SELECT COUNT(b) FROM TranscriptionBlock b JOIN Document d ON d.id = b.documentId @@ -69,6 +71,8 @@ public interface TranscriptionBlockRepository extends JpaRepository(Set.of(TrainingLabel.KURRENT_RECOGNITION))) + .trainingLabels(kurrentLabels()) .build()); kurrentDocId = kurrentDoc.getId(); @@ -123,7 +123,7 @@ class TrainingBlockQueryTest { .originalFilename("karl.pdf") .status(DocumentStatus.UPLOADED) .sender(sender) - .trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION))) + .trainingLabels(kurrentLabels()) .build()); UUID annId = annotationRepository.save(annotation(doc.getId())).getId(); blockRepository.save(block(doc.getId(), annId, BlockSource.MANUAL, false)); @@ -158,7 +158,7 @@ class TrainingBlockQueryTest { .originalFilename("karl.pdf") .status(DocumentStatus.UPLOADED) .sender(sender) - .trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION))) + .trainingLabels(kurrentLabels()) .build()); UUID annId = annotationRepository.save(annotation(doc.getId())).getId(); blockRepository.save(block(doc.getId(), annId, BlockSource.OCR, false)); @@ -177,7 +177,7 @@ class TrainingBlockQueryTest { .originalFilename("karl.pdf") .status(DocumentStatus.UPLOADED) .sender(karl) - .trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION))) + .trainingLabels(kurrentLabels()) .build()); UUID annId = annotationRepository.save(annotation(doc.getId())).getId(); blockRepository.save(block(doc.getId(), annId, BlockSource.MANUAL, false)); @@ -195,7 +195,7 @@ class TrainingBlockQueryTest { .originalFilename("karl.pdf") .status(DocumentStatus.UPLOADED) .sender(sender) - .trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION))) + .trainingLabels(kurrentLabels()) .build()); UUID annId = annotationRepository.save(annotation(doc.getId())).getId(); blockRepository.save(block(doc.getId(), annId, BlockSource.MANUAL, false)); @@ -218,6 +218,10 @@ class TrainingBlockQueryTest { // ─── helpers ───────────────────────────────────────────────────────────── + private static Set kurrentLabels() { + return new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)); + } + private DocumentAnnotation annotation(UUID docId) { return DocumentAnnotation.builder() .documentId(docId)