Merge pull request #3465 from skitt/smart-spread-fix

Fix the smart shuffle spread calculation
This commit is contained in:
H. Lehmann 2019-09-29 12:50:21 +02:00 committed by GitHub
commit cf367c02af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,7 @@ public class QueueSorter {
Collections.sort(feedItems, itemComparator);
if (spread == 0) {
spread = feedItems.size();
} else if (feedItems.size() % spread != 0){
} else if (spread % feedItems.size() != 0){
spread *= feedItems.size();
}
}
@ -180,6 +180,9 @@ public class QueueSorter {
Map<Long, List<FeedItem>> spreadItems = new HashMap<>();
for (List<FeedItem> feedItems : feeds) {
long thisSpread = spread / feedItems.size();
if (thisSpread == 0) {
thisSpread = 1;
}
// Starting from 0 ensures we front-load, so the queue starts with one episode from
// each feed in the queue
long itemSpread = 0;