Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion apps/package-manager/packages/generic/src/fakeCore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable node/no-extraneous-import */
import { ExternalPeripheralDeviceAPI } from '@sofie-automation/server-core-integration/dist/lib/methods'
import { ExternalPeripheralDeviceAPI } from '@sofie-automation/server-core-integration'
import { ExpectedPackageId } from '@sofie-automation/shared-lib/dist/core/model/Ids'
import { LoggerInstance } from '@sofie-package-manager/api'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,26 +435,25 @@ function addExpectation(
}
/** Returns a priority for an expectation. */
function getPriority(
_activeRundownMap: Map<RundownId, PackageManagerActiveRundown>,
_packageWrap: ExpectedPackageWrap,
activeRundownMap: Map<RundownId, PackageManagerActiveRundown>,
packageWrap: ExpectedPackageWrap,
exp: Expectation.Any
): number {
// Returns the initial priority, based on the expectedPackage

// HACK: This is wanted, but is causing type errors, so disable temporarily
// const activeRundown: PackageManagerActiveRundown | undefined = packageWrap.expectedPackage.rundownId
// ? activeRundownMap.get(packageWrap.expectedPackage.rundownId)
// : undefined

// if (activeRundown) {
// // The expected package is in an active rundown.
// // Earlier rundowns should have higher priority:
// return exp.priority + activeRundown._rank + PriorityMagnitude.PLAY_NOW
// } else {
// The expected package is in an inactive rundown.
// Make that a low priority:
return exp.priority + PriorityMagnitude.OTHER
// }
const activeRundown: PackageManagerActiveRundown | undefined = packageWrap.expectedPackage.rundownId
? activeRundownMap.get(packageWrap.expectedPackage.rundownId)
: undefined

if (activeRundown) {
// The expected package is in an active rundown.
// Earlier rundowns should have higher priority:
return exp.priority + activeRundown._rank + PriorityMagnitude.PLAY_NOW
} else {
// The expected package is in an inactive rundown.
// Make that a low priority:
return exp.priority + PriorityMagnitude.OTHER
}
}
type ExpectationCollection = Record<ExpectationId, GenerateExpectation>

Expand Down
8 changes: 8 additions & 0 deletions apps/package-manager/packages/generic/src/packageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import {
ExpectedPackageId as CoreExpectedPackageId,
ExpectedPackageWorkStatusId,
RundownId,
} from '@sofie-automation/shared-lib/dist/core/model/Ids'
import {
PackageManagerActivePlaylist,
Expand Down Expand Up @@ -306,7 +307,7 @@

const expectedPackagesCore: ExpectedPackageWrap[] = []
for (const expectedPackagesObj of expectedPackagesObjs) {
expectedPackagesCore.push(expectedPackagesObj as any as ExpectedPackageWrap)

Check warning on line 310 in apps/package-manager/packages/generic/src/packageManager.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This assertion is unnecessary since the receiver accepts the original type of the expression.

See more on https://sonarcloud.io/project/issues?id=Sofie-Automation_sofie-package-manager&issues=AZ4hM9qVoNXn05QXQC2w&open=AZ4hM9qVoNXn05QXQC2w&pullRequest=310
}
if (expectedPackagesCore.length > 0) {
expectedPackageSources.push({
Expand Down Expand Up @@ -1203,6 +1204,13 @@
}
export type ConvertExpectedPackage<E extends ExpectedPackageOrg.Base> = Omit<E, '_id' | 'sources' | 'sideEffect'> & {
_id: ExpectedPackageId

/**
* The ID of the rundown this package belongs to, if any.
* Note: This aligns with the property in the interfaces from sofie-core
*/
rundownId?: RundownId

Comment thread
coderabbitai[bot] marked this conversation as resolved.
sources: Array<
Omit<E['sources'][0], 'containerId' | 'accessors'> & {
containerId: PackageContainerId // Converts string -> PackageContainerId
Expand Down
Loading