Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS element: Repeat items and Pinned slots shows less number of items in preview #2465

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions modules/src/xibo-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ const XiboPlayer = function() {

if (data.length > 0) {
let lastSlotFilled = null;
const filledPinnedSlot = [];

dataLoop: for (const [dataItemKey] of Object.entries(data)) {
let hasSlotFilled = false;
Expand All @@ -356,6 +357,11 @@ const XiboPlayer = function() {
const slotItems = itemObj.items;
const pinnedItems = itemObj.pinnedItems;
const currentSlot = itemObj.slot;
let nextSlot = currentSlot + 1;

if (nextSlot > maxSlot) {
nextSlot = currentSlot;
}

// Skip if currentKey is less than the currentSlot
// This occurs when a data slot has been skipped
Expand Down Expand Up @@ -411,6 +417,13 @@ const XiboPlayer = function() {
lastSlotFilled = currentSlot;
}

if (pinnedSlots.includes(currentSlot) &&
lastSlotFilled === currentSlot &&
!filledPinnedSlot.includes(currentSlot)
) {
filledPinnedSlot.push(currentSlot);
}

itemObj.dataKeys = [
...itemObj.dataKeys,
currentKey,
Expand All @@ -420,6 +433,18 @@ const XiboPlayer = function() {
hasSlotFilled = false;
if (lastSlotFilled % maxSlot === 0) {
lastSlotFilled = null;
} else if (currentKey > maxSlot &&
nextSlot !== currentSlot &&
pinnedSlots.includes(nextSlot) &&
filledPinnedSlot.includes(nextSlot)
) {
// Next slot is a pinned slot and has been filled
// So, current item must be passed to next non-pinned slot
if (nextSlot === maxSlot) {
lastSlotFilled = null;
} else {
lastSlotFilled = nextSlot;
}
}

break;
Expand Down