Skip to content

Commit

Permalink
fix: segment remaining timer not counting
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 2, 2024
1 parent 7cbdae5 commit 8d323b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
17 changes: 0 additions & 17 deletions packages/webui/src/client/lib/__tests__/rundownTiming.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -270,7 +269,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -372,7 +370,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -478,7 +475,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -605,7 +601,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -760,7 +755,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: 2500,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: undefined,
})
)
Expand Down Expand Up @@ -916,7 +910,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: -4000,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: undefined,
})
)
Expand Down Expand Up @@ -1021,7 +1014,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -1159,7 +1151,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -1280,7 +1271,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
})
)
})
Expand Down Expand Up @@ -1400,7 +1390,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: undefined,
remainingTimeOnCurrentPart: undefined,
rundownsBeforeNextBreak: undefined,
segmentStartedPlayback: {},
nextRundownAnchor: undefined,
})
)
Expand Down Expand Up @@ -1549,7 +1538,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: 500,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: 2000,
})
)
Expand Down Expand Up @@ -1698,7 +1686,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: -1500,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: 4000,
})
)
Expand Down Expand Up @@ -1853,7 +1840,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: 500,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: 3000,
})
)
Expand Down Expand Up @@ -2002,7 +1988,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: 500,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: 2000,
})
)
Expand Down Expand Up @@ -2151,7 +2136,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: -1500,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: 4000,
})
)
Expand Down Expand Up @@ -2306,7 +2290,6 @@ describe('rundown Timing Calculator', () => {
breakIsLastRundown: false,
remainingTimeOnCurrentPart: 500,
rundownsBeforeNextBreak: [],
segmentStartedPlayback: {},
nextRundownAnchor: 3000,
})
)
Expand Down
7 changes: 1 addition & 6 deletions packages/webui/src/client/lib/rundownTiming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class RundownTimingCalculator {
private partDisplayDurations: Record<TimingId, number> = {}
private partDisplayDurationsNoPlayback: Record<TimingId, number> = {}
private displayDurationGroups: Record<string, number> = {}
private segmentStartedPlayback: Record<string, number> = {}
private segmentAsPlayedDurations: Record<string, number> = {}
private breakProps: {
props: BreakProps | undefined
Expand Down Expand Up @@ -124,7 +123,6 @@ export class RundownTimingCalculator {
let liveSegmentId: SegmentId | undefined

Object.keys(this.displayDurationGroups).forEach((key) => delete this.displayDurationGroups[key])
Object.keys(this.segmentStartedPlayback).forEach((key) => delete this.segmentStartedPlayback[key])
Object.keys(this.segmentAsPlayedDurations).forEach((key) => delete this.segmentAsPlayedDurations[key])
this.untimedSegments.clear()
this.linearParts.length = 0
Expand Down Expand Up @@ -163,7 +161,7 @@ export class RundownTimingCalculator {

if (liveSegment?.segmentTiming?.countdownType === CountdownType.SEGMENT_BUDGET_DURATION) {
remainingBudgetOnCurrentSegment =
(this.segmentStartedPlayback[unprotectString(liveSegmentId)] ??
(playlist.segmentsStartedPlayback?.[unprotectString(liveSegmentId)] ??
lastStartedPlayback ??
now) +
(liveSegment.segmentTiming.budgetDuration ?? 0) -
Expand Down Expand Up @@ -629,7 +627,6 @@ export class RundownTimingCalculator {
partDisplayStartsAt: this.partDisplayStartsAt,
partExpectedDurations: this.partExpectedDurations,
partDisplayDurations: this.partDisplayDurations,
segmentStartedPlayback: this.segmentStartedPlayback,
currentTime: now,
remainingTimeOnCurrentPart,
remainingBudgetOnCurrentSegment,
Expand Down Expand Up @@ -722,8 +719,6 @@ export interface RundownTimingContext {
* if the Part does not have an expected duration.
*/
partExpectedDurations?: Record<string, number>
/** Time when selected segments started playback. Contains only the current segment and the segment before, if we've just entered a new one */
segmentStartedPlayback?: Record<string, number>
/** Remaining time on current part */
remainingTimeOnCurrentPart?: number
/** Remaining budget on current segment, if its countdownType === CountdownType.SEGMENT_BUDGET_DURATION */
Expand Down

0 comments on commit 8d323b7

Please sign in to comment.