Skip to content

Commit c3c3ae4

Browse files
Fix shuffle dropping a past contributor on every page load
The Fisher-Yates shuffle in the past-contributors section redistributed cards at a hardcoded 3-per-row across 2 rows, giving 6 slots for 7 cards and silently dropping whichever card landed at index 6. Laurent Soucasse was already in the source but vanished about 1-in-7 page loads (the same held for any of the other 6 cards). Compute per-row capacity as ceil(totalCards / numRows) so all cards always render. Bootstrap .col-lg-4 wraps a 4th column onto a second visual line within the same .row, so the layout stays clean.
1 parent 15ff845 commit c3c3ae4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

_includes/components/teams/team-carousel-2.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,10 +1337,13 @@ <h6 class="mb-1">Numerical methods</h6>
13371337
}
13381338
});
13391339

1340-
// Redistribute shuffled cards (3 per row)
1340+
// Redistribute shuffled cards across the available rows, scaling per-row
1341+
// capacity to the actual card count so no card is ever dropped. Bootstrap
1342+
// .col-lg-4 wraps a 4th card to a second visual line within the same .row.
1343+
const perRow = Math.ceil(allCards.length / cardRows.length);
13411344
let cardIndex = 0;
13421345
cardRows.forEach(row => {
1343-
for (let i = 0; i < 3 && cardIndex < allCards.length; i++) {
1346+
for (let i = 0; i < perRow && cardIndex < allCards.length; i++) {
13441347
row.appendChild(allCards[cardIndex]);
13451348
cardIndex++;
13461349
}

0 commit comments

Comments
 (0)