Skip to content

Commit

Permalink
Limits 'Best rated' and 'Most visited' albums to one page i.e. 100 ph…
Browse files Browse the repository at this point in the history
…otos
  • Loading branch information
EddyLB committed Jul 11, 2024
1 parent ec9b1a7 commit adcbdf6
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions piwigo/Album/Extensions/AlbumViewController+Fetch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,25 @@ extension AlbumViewController
// No error ► Smart album?
var newLastPage = lastPage
if albumData.pwgID < 0, onPage == 0 {
// Re-calculate number of pages
newLastPage = Int(totalCount.quotientAndRemainder(dividingBy: Int64(perPage)).quotient)
// Re-calculate number of pages for some smart albums
if [pwgSmartAlbum.visits.rawValue, pwgSmartAlbum.best.rawValue].contains(albumData.pwgID) {
// Update smart album data (limited to 'perPage' photos - 15 on webUI)
if albumData.nbImages != Int64(perPage) {
albumData.nbImages = Int64(perPage)
}
if albumData.totalNbImages != Int64(perPage) {
albumData.totalNbImages = Int64(perPage)
}
} else {
newLastPage = Int(totalCount.quotientAndRemainder(dividingBy: Int64(perPage)).quotient)

// Update smart album data
if albumData.nbImages != totalCount {
albumData.nbImages = totalCount
}
if albumData.totalNbImages != totalCount {
albumData.totalNbImages = totalCount
// Update smart album data
if albumData.nbImages != totalCount {
albumData.nbImages = totalCount
}
if albumData.totalNbImages != totalCount {
albumData.totalNbImages = totalCount
}
}
}

Expand Down

0 comments on commit adcbdf6

Please sign in to comment.