refactor(dashboard): remove page field from DashboardResumeDTO; rename pages to totalBlocks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package org.raddatz.familienarchiv.dashboard;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public record DashboardResumeDTO(
|
||||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) UUID documentId,
|
||||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) String title,
|
||||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) String caption,
|
||||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) String excerpt,
|
||||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) int totalBlocks,
|
||||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) int pct,
|
||||
@Nullable String thumbnailUrl,
|
||||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) List<ActivityActorDTO> collaborators
|
||||
) {}
|
||||
@@ -53,16 +53,6 @@ public class DashboardService {
|
||||
long reviewedBlocks = blocks.stream().filter(TranscriptionBlock::isReviewed).count();
|
||||
int pct = totalBlocks > 0 ? (int) (reviewedBlocks * 100L / totalBlocks) : 0;
|
||||
|
||||
Set<Integer> pageNumbers = new HashSet<>();
|
||||
for (TranscriptionBlock b : blocks) {
|
||||
pageNumbers.add(b.getSortOrder());
|
||||
}
|
||||
int maxPage = blocks.stream().mapToInt(TranscriptionBlock::getSortOrder).max().orElse(1);
|
||||
int totalPages = Math.max(1, (int) blocks.stream()
|
||||
.mapToInt(TranscriptionBlock::getSortOrder)
|
||||
.distinct().count());
|
||||
int currentPage = 1;
|
||||
|
||||
String caption = buildCaption(doc);
|
||||
|
||||
List<UUID> collaboratorIds = blocks.stream()
|
||||
@@ -85,7 +75,7 @@ public class DashboardService {
|
||||
.toList();
|
||||
|
||||
return new DashboardResumeDTO(docId, doc.getTitle(), caption, excerpt,
|
||||
currentPage, totalPages, pct, null, collaborators);
|
||||
totalBlocks, pct, null, collaborators);
|
||||
}
|
||||
|
||||
public DashboardPulseDTO getPulse(UUID userId) {
|
||||
|
||||
Reference in New Issue
Block a user