Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Bug "Segment xyz not found" (SOFIE-3544) #1302

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/job-worker/src/ingest/syncChangesToPartInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
import { validateAdlibTestingPartInstanceProperties } from '../playout/adlibTesting'
import { ReadonlyDeep } from 'type-fest'
import { convertIngestModelToPlayoutRundownWithSegments } from './commit'
import { PlayoutRundownModel } from '../playout/model/PlayoutRundownModel'

type PlayStatus = 'previous' | 'current' | 'next'
type SyncedInstance = {
Expand Down Expand Up @@ -132,12 +133,22 @@ export async function syncChangesToPartInstances(
pieceInstances: pieceInstancesInPart.map((p) => convertPieceInstanceToBlueprints(p.pieceInstance)),
}

const part = newPart ?? existingPartInstance.partInstance.part

let playoutRundownModelForPart: PlayoutRundownModel | undefined = playoutRundownModel
// Handle a case where the part is in a different rundown than the playoutRundownModel:
if (playoutRundownModel.rundown._id !== part.rundownId) {
playoutRundownModelForPart = playoutModel.getRundown(part.rundownId)
}
if (!playoutRundownModelForPart)
throw new Error(`Internal Error: playoutRundownModelForPart is undefined (it should never be)`)

const proposedPieceInstances = getPieceInstancesForPart(
context,
playoutModel,
previousPartInstance,
playoutRundownModel,
newPart ?? existingPartInstance.partInstance.part,
playoutRundownModelForPart,
part,
await piecesThatMayBeActive,
existingPartInstance.partInstance._id
)
Expand Down
Loading