Skip to content

Commit

Permalink
Merge branch 'main' into issue271-fix-stream-api-offset
Browse files Browse the repository at this point in the history
  • Loading branch information
kagemomiji authored Feb 5, 2024
2 parents a9bf568 + fded47f commit 270a871
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public interface AlbumRepository extends JpaRepository<Album, Integer> {

public Optional<Album> findByIdAndStarredAlbumsUsername(Integer id, String username);

public boolean existsByLastScannedBeforeAndPresentTrue(Instant lastScanned);

@Transactional
public void deleteAllByPresentFalse();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public List<Artist> findByFolderInAndPresentTrue(Iterable<MusicFolder> musicFold

public boolean existsByName(String name);

public boolean existsByLastScannedBeforeAndPresentTrue(Instant lastScanned);

@Transactional
public void deleteAllByPresentFalse();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ public int getAlbumCount(List<MusicFolder> musicFolders) {
*/
@Transactional
public void markNonPresent(Instant lastScanned) {
albumRepository.markNonPresent(lastScanned);
if (albumRepository.existsByLastScannedBeforeAndPresentTrue(lastScanned)) {
albumRepository.markNonPresent(lastScanned);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ public void expunge() {
*/
@Transactional
public void markNonPresent(Instant lastScanned) {
artistRepository.markNonPresent(lastScanned);
if (artistRepository.existsByLastScannedBeforeAndPresentTrue(lastScanned)) {
artistRepository.markNonPresent(lastScanned);
}
}

/**
Expand Down

0 comments on commit 270a871

Please sign in to comment.