Skip to content

Commit ec1114e

Browse files
committed
feat(EAV-603): add manuallySelected to OnSetAsNextContext
1 parent 26ccb1f commit ec1114e

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

packages/blueprints-integration/src/context/onSetAsNextContext.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export interface IOnSetAsNextContext extends IShowStyleUserContext, IEventContex
2020
/** Information about the current loop, if there is one */
2121
readonly quickLoopInfo: BlueprintQuickLookInfo | null
2222

23+
/** Whether the part being set as next was selected as a result of user's actions */
24+
readonly manuallySelected: boolean
25+
2326
/**
2427
* Data fetching
2528
*/

packages/job-worker/src/blueprints/__tests__/context-OnSetAsNextContext.test.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { PartAndPieceInstanceActionService } from '../context/services/PartAndPi
88
import { OnSetAsNextContext } from '../context/index.js'
99

1010
describe('Test blueprint api context', () => {
11-
async function getTestee() {
11+
async function getTestee(setManually = false) {
1212
const mockActionService = mock<PartAndPieceInstanceActionService>()
1313
const context = new OnSetAsNextContext(
1414
{
@@ -19,7 +19,8 @@ describe('Test blueprint api context', () => {
1919
mock<PlayoutModel>(),
2020
mock<ProcessedShowStyleCompound>(),
2121
mock<WatchedPackagesHelper>(),
22-
mockActionService
22+
mockActionService,
23+
setManually
2324
)
2425

2526
return {
@@ -28,7 +29,7 @@ describe('Test blueprint api context', () => {
2829
}
2930
}
3031

31-
describe('ActionExecutionContext', () => {
32+
describe('OnSetAsNextContext', () => {
3233
test('getPartInstance', async () => {
3334
const { context, mockActionService } = await getTestee()
3435

@@ -134,5 +135,17 @@ describe('Test blueprint api context', () => {
134135
expect(mockActionService.updatePartInstance).toHaveBeenCalledTimes(1)
135136
expect(mockActionService.updatePartInstance).toHaveBeenCalledWith('next', { title: 'My Part' })
136137
})
138+
139+
test('manuallySelected when false', async () => {
140+
const { context } = await getTestee(false)
141+
142+
expect(context.manuallySelected).toBe(false)
143+
})
144+
145+
test('manuallySelected when true', async () => {
146+
const { context } = await getTestee(true)
147+
148+
expect(context.manuallySelected).toBe(true)
149+
})
137150
})
138151
})

packages/job-worker/src/blueprints/context/OnSetAsNextContext.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export class OnSetAsNextContext
3939
private playoutModel: PlayoutModel,
4040
showStyle: ReadonlyDeep<ProcessedShowStyleCompound>,
4141
watchedPackages: WatchedPackagesHelper,
42-
private partAndPieceInstanceService: PartAndPieceInstanceActionService
42+
private partAndPieceInstanceService: PartAndPieceInstanceActionService,
43+
public readonly manuallySelected: boolean
4344
) {
4445
super(contextInfo, context, showStyle, watchedPackages)
4546
}

packages/job-worker/src/playout/setNext.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ async function setNextPartAndCheckForPendingMoveNextPart(
177177

178178
playoutModel.setPartInstanceAsNext(newPartInstance, setManually, consumesQueuedSegmentId, nextTimeOffset)
179179

180-
return executeOnSetAsNextCallback(playoutModel, newPartInstance, context)
180+
return executeOnSetAsNextCallback(playoutModel, newPartInstance, context, setManually)
181181
} else {
182182
// Set to null
183183

@@ -189,7 +189,8 @@ async function setNextPartAndCheckForPendingMoveNextPart(
189189
async function executeOnSetAsNextCallback(
190190
playoutModel: PlayoutModel,
191191
newPartInstance: PlayoutPartInstanceModel,
192-
context: JobContext
192+
context: JobContext,
193+
setManually: boolean
193194
) {
194195
const NOTIFICATION_CATEGORY = 'onSetAsNext'
195196

@@ -219,7 +220,8 @@ async function executeOnSetAsNextCallback(
219220
playoutModel,
220221
showStyle,
221222
watchedPackagesHelper,
222-
new PartAndPieceInstanceActionService(context, playoutModel, showStyle, rundownOfNextPart)
223+
new PartAndPieceInstanceActionService(context, playoutModel, showStyle, rundownOfNextPart),
224+
setManually
223225
)
224226

225227
// Clear any existing notifications for this partInstance. This will clear any from the previous setAsNext

0 commit comments

Comments
 (0)