File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
meteor/server/publications/pieceContentStatusUI Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,10 @@ export type PieceContentStatusPiece = Pick<
198198 '_id' | 'content' | 'expectedPackages' | 'name'
199199> & {
200200 pieceInstanceId ?: PieceInstanceId
201+ /**
202+ * If this is an infinite continuation, check the previous PieceInstance to fill the gap when package-manager has not processed an adlibbed part
203+ */
204+ previousPieceInstanceId ?: PieceInstanceId
201205}
202206export interface PieceContentStatusStudio
203207 extends Pick < DBStudio , '_id' | 'previewContainerIds' | 'thumbnailContainerIds' > {
@@ -656,6 +660,13 @@ async function checkPieceContentExpectedPackageStatus(
656660 if ( piece . pieceInstanceId ) {
657661 // If this is a PieceInstance, try looking up the PieceInstance first
658662 expectedPackageIds . unshift ( getExpectedPackageId ( piece . pieceInstanceId , expectedPackage . _id ) )
663+
664+ if ( piece . previousPieceInstanceId ) {
665+ // Also try the previous PieceInstance, when this is an infinite continuation in case package-manager needs to catchup
666+ expectedPackageIds . unshift (
667+ getExpectedPackageId ( piece . previousPieceInstanceId , expectedPackage . _id )
668+ )
669+ }
659670 }
660671
661672 let warningMessage : ContentMessageLight | null = null
Original file line number Diff line number Diff line change @@ -64,14 +64,15 @@ export const partInstanceFieldSpecifier = literal<
6464 part : 1 , // This could be stricter, but this is unlikely to be changed once the PartInstance is created
6565} )
6666
67- export type PieceInstanceFields = '_id' | 'rundownId' | 'partInstanceId' | 'piece'
67+ export type PieceInstanceFields = '_id' | 'rundownId' | 'partInstanceId' | 'piece' | 'infinite'
6868export const pieceInstanceFieldSpecifier = literal <
6969 MongoFieldSpecifierOnesStrict < Pick < PieceInstance , PieceInstanceFields > >
7070> ( {
7171 _id : 1 ,
7272 rundownId : 1 ,
7373 partInstanceId : 1 ,
7474 piece : 1 , // This could be stricter, but this is unlikely to be changed once the PieceInstance is created
75+ infinite : 1 , // This could be stricter, but this is temporary and should never change once set
7576} )
7677
7778export type AdLibPieceFields =
Original file line number Diff line number Diff line change @@ -166,13 +166,26 @@ export async function regenerateForPieceInstanceIds(
166166 const sourceLayer =
167167 pieceDoc . piece . sourceLayerId && sourceLayersForRundown ?. sourceLayers ?. [ pieceDoc . piece . sourceLayerId ]
168168
169+ let previousPieceInstanceId : PieceInstanceId | undefined
170+ if ( pieceDoc . infinite ) {
171+ // Note: this is a temporary solution, until single packages can be owned by multiple PieceInstances
172+ // This shouldn't need to be reactive upon this PieceInstance, as this is filling a brief gap until package-manager catches up.
173+ // That assumption could be wrong, but trying to track this dependency will be messy so would be nice to avoid.
174+ const previousPieceInstance = contentCache . PieceInstances . findOne ( {
175+ 'infinite.infiniteInstanceId' : pieceDoc . infinite . infiniteInstanceId ,
176+ 'infinite.infiniteInstanceIndex' : pieceDoc . infinite . infiniteInstanceIndex - 1 ,
177+ } )
178+ previousPieceInstanceId = previousPieceInstance ?. _id
179+ }
180+
169181 if ( partInstance && segment && sourceLayer ) {
170182 const [ status , dependencies ] = await checkPieceContentStatusAndDependencies (
171183 uiStudio ,
172184 messageFactories . get ( pieceDoc . rundownId ) ,
173185 {
174186 ...pieceDoc . piece ,
175187 pieceInstanceId : pieceDoc . _id ,
188+ previousPieceInstanceId,
176189 } ,
177190 sourceLayer
178191 )
You can’t perform that action at this time.
0 commit comments