File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
packages/job-worker/src/ingest Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import {
3232import { validateAdlibTestingPartInstanceProperties } from '../playout/adlibTesting'
3333import { ReadonlyDeep } from 'type-fest'
3434import { convertIngestModelToPlayoutRundownWithSegments } from './commit'
35+ import { PlayoutRundownModel } from '../playout/model/PlayoutRundownModel'
3536
3637type PlayStatus = 'previous' | 'current' | 'next'
3738type SyncedInstance = {
@@ -132,12 +133,22 @@ export async function syncChangesToPartInstances(
132133 pieceInstances : pieceInstancesInPart . map ( ( p ) => convertPieceInstanceToBlueprints ( p . pieceInstance ) ) ,
133134 }
134135
136+ const part = newPart ?? existingPartInstance . partInstance . part
137+
138+ let playoutRundownModelForPart : PlayoutRundownModel | undefined = playoutRundownModel
139+ // Handle a case where the part is in a different rundown than the playoutRundownModel:
140+ if ( playoutRundownModel . rundown . _id !== part . rundownId ) {
141+ playoutRundownModelForPart = playoutModel . getRundown ( part . rundownId )
142+ }
143+ if ( ! playoutRundownModelForPart )
144+ throw new Error ( `Internal Error: playoutRundownModelForPart is undefined (it should never be)` )
145+
135146 const proposedPieceInstances = getPieceInstancesForPart (
136147 context ,
137148 playoutModel ,
138149 previousPartInstance ,
139- playoutRundownModel ,
140- newPart ?? existingPartInstance . partInstance . part ,
150+ playoutRundownModelForPart ,
151+ part ,
141152 await piecesThatMayBeActive ,
142153 existingPartInstance . partInstance . _id
143154 )
You can’t perform that action at this time.
0 commit comments