Skip to content

Commit

Permalink
Fix breaks @ end of day
Browse files Browse the repository at this point in the history
  • Loading branch information
Techno11 committed Apr 5, 2024
1 parent 4a62ada commit 69279df
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/MultiDisplay/EventRow/QualRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ const QualRow = ({
.filter((x) => x !== null) as QualMatch[],
);

// Calculate the max # of matches we should be displaying
const maxMatches = 2 + maxQ; // current + next + queueing

// See if there is an upcoming break
breaks?.forEach((b: Break) => {
// See if break start is inside what we're showing
Expand All @@ -117,8 +120,10 @@ const QualRow = ({
if (insertAt < 0) return;
// Insert break
upcoming.splice(insertAt, 0, b);
// Remove one from the end
upcoming.pop();
// Verify that the array is not too long
if (upcoming.length > maxMatches) {
upcoming.splice(maxMatches, upcoming.length - maxMatches);
}
}
});

Expand Down

0 comments on commit 69279df

Please sign in to comment.