Commit 06c6d8ad authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Merge branch 'bug-fixes' into 'master'

Bug fixes

See merge request grp-fidentis/analyst-webapp!58
parents 4c64c8c1 cbd43475
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@ public class BatchDistanceServiceImpl implements BatchDistanceService {
            case PAIRWISE_TWO_WAY_CROPPED -> batchPairwiseService.calculateDistance(dto, true);
        };

        if (responseDto == null) {
            return null;
        }
        BatchDistancesDto batchDistancesDto = transformResponseDto(dto.getFileIds(), responseDto);
        batchDistancesDto.setTaskId(dto.getTaskId());
        return batchDistancesDto;
+7 −1
Original line number Diff line number Diff line
@@ -200,9 +200,15 @@ public class BatchRegistrationServiceImpl extends BatchBaseService implements Ba
                return CompletableFuture.completedFuture(null);
            }
            HumanFace superimposedFace = getHumanFaceAtIndexFromArray(i, dto.getFileIds(), dto.getTaskId());
            em.clear();
            HumanFaceEntity faceEntity = humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(dto.getFileIds().get(i), dto.getTaskId(), false);

            batchFaceRegistration.register(superimposedFace);

            faceEntity.setHumanFaceDump(SerializationUtils.serialize(superimposedFace));

            em.flush();
            em.clear();

            dto.setCalculationProgress(dto.getCalculationProgress() + progressStep);
            webSocketProgressHandler.updateProgress(dto.getCalculationWebSocketSessionId(), dto.getCalculationProgress());
        }
+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public abstract class BatchBaseService {
    protected final WebSocketProgressHandler webSocketProgressHandler;

    protected HumanFace getSelectedFace(Long fileId, Long taskId) {
        return humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(fileId, taskId)
        return humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(fileId, taskId, true)
                .getHumanFace();
    }

@@ -45,7 +45,7 @@ public abstract class BatchBaseService {
                .map(FileUpload::getId)
                .map(fileUploadId -> {
                    try {
                        return humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(fileUploadId, dto.getTaskId())
                        return humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(fileUploadId, dto.getTaskId(), true)
                                .getHumanFace();
                    } catch (EntityNotFoundException e) {
                        return null;
@@ -57,7 +57,7 @@ public abstract class BatchBaseService {
    protected HumanFace getHumanFaceAtIndexFromArray(int faceIndex, List<Long> filesIds, Long taskId) {
        Long fileId = filesIds.get(faceIndex);
        try {
            HumanFaceEntity humanFaceEntity = humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(fileId, taskId);
            HumanFaceEntity humanFaceEntity = humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(fileId, taskId, true);
            return humanFaceEntity.getHumanFace();
        } catch (EntityNotFoundException e) {
            return createAndFetchHumanFace(fileId, taskId);
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ public class FileUploadServiceImpl implements FileUploadService {
    }

    private FileUpload updateExistingAverageFaceFile(FileUpload averageFaceFile, HumanFace newAvgFace, Long taskId) {
        HumanFaceEntity avgFaceEntity = humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(averageFaceFile.getId(), taskId);
        HumanFaceEntity avgFaceEntity = humanFaceService.getHumanFaceEntityByFileUploadIdAndTaskId(averageFaceFile.getId(), taskId, false);
        avgFaceEntity.setHumanFaceDump(SerializationUtils.serialize(newAvgFace));
        return averageFaceFile;
    }
+1 −3
Original line number Diff line number Diff line
@@ -62,7 +62,5 @@ public interface HumanFaceRepo extends JpaRepository<HumanFaceEntity, Long> {
     * @param taskId ID of task
     * @return {@code HumanFaceEntity} for selected task
     */
    @EntityGraph(attributePaths = "fileUploads")
    @Query("SELECT h FROM HumanFaceEntity h WHERE h.task.id = :taskId ORDER BY h.id ASC LIMIT 1")
    Optional<HumanFaceEntity> findFirstHumanFaceEntityByTaskId(Long taskId);
    Optional<HumanFaceEntity> findFirstByTaskId(Long taskId);
}
Loading