Skip to content

feat: auto-step feature for scheduled groups#6

Open
dedicatedbroadcastsolutions wants to merge 9 commits intopr3-helpersfrom
pr4-on-pr5
Open

feat: auto-step feature for scheduled groups#6
dedicatedbroadcastsolutions wants to merge 9 commits intopr3-helpersfrom
pr4-on-pr5

Conversation

@dedicatedbroadcastsolutions
Copy link
Owner

Rebase of PR #4 on top of PR #5.

Changes

  • Add autoStep property to Group model for cycling through parts at scheduled times
  • Implement Auto Step logic in scheduler to cycle through parts sequentially
  • Add Auto Step UI control in Group Settings sidebar (visible when in Schedule mode)
  • Add Auto Step toggle button in Group View header (visible when in Schedule mode)
  • Fix loop logic to prevent playing extra part when loop is disabled

This feature allows multi-part groups to automatically cycle through parts at each scheduled start time, enabling playlist-like behavior for scheduled content.

- Add autoStep property to Group model for cycling through parts at scheduled times
- Implement Auto Step logic in scheduler to cycle through parts sequentially
- Add Auto Step UI control in Group Settings sidebar (visible when in Schedule mode)
- Add Auto Step toggle button in Group View header (visible when in Schedule mode)
- Fix loop logic to prevent playing extra part when loop is disabled

This feature allows multi-part groups to automatically cycle through parts at each scheduled start time, enabling playlist-like behavior for scheduled content.
…red start times

- Fix bug where Auto Step incorrectly selected parts when scheduled start times were filtered out
- Track occurrence index separately from array index to ensure correct part cycling
- Increment occurrence index only when start time passes the filter (startTime >= lastStopTime)
- This ensures parts cycle correctly even when some scheduled times are filtered due to currently playing parts

Fixes issue where parts would be selected incorrectly based on array position
rather than actual occurrence number when start times are filtered.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds an auto-step feature for scheduled groups, allowing multi-part groups to automatically cycle through parts at each scheduled start time, enabling playlist-like behavior for scheduled content.

Key changes:

  • Added autoStep property to the Group model with proper default value
  • Implemented auto-step logic in the scheduler to cycle through parts sequentially at each scheduled start time
  • Added UI controls in both the Group Settings sidebar and Group View header (visible only in Schedule mode)
  • Fixed loop logic to stop scheduling when loop is disabled after all parts have been played

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/app/src/models/rundown/Group.ts Added optional autoStep boolean property to GroupBase interface with documentation
apps/app/src/lib/defaults.ts Set default value of autoStep to false for new groups
apps/app/src/lib/playout/preparedGroupPlayData.ts Implemented auto-step logic to cycle through parts at scheduled times, with support for loop enable/disable
apps/app/src/react/components/rundown/GroupView/GroupView.tsx Added Auto Step toggle button in group header (visible in Schedule mode) and imported PlayoutMode enum
apps/app/src/react/components/sidebar/editGroup/SideBarEditGroup.tsx Added Auto Step setting in sidebar within the Schedule mode settings block

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 77 to 103
// Auto Step: cycle through parts at each scheduled start time
if (group.autoStep) {
// Track occurrence index separately from array index
// This ensures correct part selection even when some start times are filtered out
let occurrenceIndex = 0
for (let i = 0; i < repeatResult.startTimes.length; i++) {
const startTime = repeatResult.startTimes[i]
if (startTime >= (lastStopTime ?? 0)) {
// If loop is disabled and we've cycled through all parts, stop scheduling
if (!group.loop && occurrenceIndex >= playableParts.length) {
break
}

// Calculate which part to play based on occurrence number, not array index
const partIndex = occurrenceIndex % playableParts.length
const partToPlay = playableParts[partIndex]

actions.push({
time: startTime,
partId: partToPlay.id,
fromSchedule: true,
})

// Increment occurrence index only for times that pass the filter
occurrenceIndex++
}
}
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new auto-step feature for scheduled groups lacks test coverage. The preparedGroupPlayData.test.ts file contains comprehensive tests for other playout scenarios, but there are no tests for the auto-step functionality. Consider adding test cases for:

  1. Auto-step cycling through parts in sequence
  2. Auto-step with loop enabled (should repeat from the first part after the last)
  3. Auto-step with loop disabled (should stop after cycling through all parts once)
  4. Auto-step with repeating schedules
  5. Auto-step behavior when some start times are filtered out (before lastStopTime)

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants