-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: Budget Duration #556
Conversation
When a segment is past the budget, the planned start of the next segment should be now
Codecov Report
@@ Coverage Diff @@
## release38 #556 +/- ##
==============================================
+ Coverage 67.39% 82.46% +15.06%
==============================================
Files 264 12 -252
Lines 18374 1015 -17359
Branches 4083 210 -3873
==============================================
- Hits 12384 837 -11547
+ Misses 5949 177 -5772
+ Partials 41 1 -40 Continue to review full report at Codecov.
|
prevents issus in a future merge with tv2:feat/rundown-view-customization
It would be good if another unit test be added into |
probably a bad merge from times when `findPartInstanceInMapOrWrapToTemporary` did not exist
I added a test case. Note: this feature currently affects only the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really confused by some of the implementation & some parts can be definitely implemented in a more straightforward fashion & reducing the amount of inter-dependency between the components.
@@ -6,6 +6,8 @@ import { PartUi } from '../../SegmentTimeline/SegmentTimelineContainer' | |||
|
|||
interface ISegmentDurationProps { | |||
parts: PartUi[] | |||
budgetDuration?: number | |||
playedOutDuration: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this is used for definitely needs a comment. I would expect SegmentDuration component to figure out the playedOutDuration of given parts on it's own, so maybe this should be called playedOutDurationOverride
or something like that? Same for budgetDuration
, since calculating the budget was also something that used to be only done internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed those properties in favor of timingDurations
isLastInSegment={false} | ||
isAfterLastValidInSegmentAndItsLive={false} | ||
isBudgetGap={true} | ||
part={{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is, this will create a new part object for every render of the component, even though this object is essentially constant through the lifetime of the component. This needs to be converted to a constant that gets reused on every render.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a7a9c6c
onContextMenu?: (contextMenuContext: IContextMenuContext) => void | ||
isLastInSegment: boolean | ||
isAfterLastValidInSegmentAndItsLive: boolean | ||
isLastSegment: boolean | ||
isBudgetGap: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be made optional. isBudgetGap
is specified as true
in just one single line. Makes no sense to keep writing isBudgetGap=false
all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in b46f8ae
@@ -421,11 +423,11 @@ export const SourceLayerItem = withTranslation()( | |||
} | |||
|
|||
private mountResizeObserver() { | |||
if (this.props.isLiveLine && !this._resizeObserver && this.state.itemElement) { | |||
if (this.props.isLiveLine && !this._resizeObserver && this.itemElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this using the state anymore? Using state is definitely safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storing refs in state doesn't play well with componentDidMount
, where we're using this ref
@@ -615,6 +622,21 @@ export const SegmentTimelineContainer = translateWithTracker<IProps, IState, ITr | |||
window.removeEventListener('resize', this.onWindowResize) | |||
} | |||
|
|||
private getSegmentBudgetDuration(): number | undefined { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm somewhat confused. So RundownTimingCalculator
seems to already be doing almost the same thing, and yet then the Segment component seems to be doing it again? And then it feels like it only does that to pass that information forward to components that have access to the timing context anyway, so they could just get it from the Calculator. Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SegmentTimelineContainer
's tracker seems to be a better place to do it, which adresses #556 (comment) as well.
Why can't the value come from RundownTimingCalculator
? It could but we would need to do an extra comparison every time SegmentTimelineClass
receives its HR time event.
@@ -794,11 +816,14 @@ export const SegmentTimelineContainer = translateWithTracker<IProps, IState, ITr | |||
? partOffset + e.detail.currentTime - virtualStartedPlayback + lastTakeOffset | |||
: partOffset + lastTakeOffset | |||
|
|||
const budgetDuration = this.getSegmentBudgetDuration() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do this in the onAirLineRefresh()
? This is going to happen on every tick, yet getSegmentBudgetDuration()
only depends on semi-constant budgetDuration
on the PartInstance. Wouldn't it make more sense to calculate that reactively in the tracker, which already depends on those PartInstances, so it's going to refresh if/when they change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to the tracker
@ianshade Can you look into the PR review? I guess you would like this merged into Release 38. |
We found an issue causing this to break the fit-to-viewport zoom feature. We're still working on a fix |
`segment-timeline__timeline` has now a min-width to make the gap part self-adjust using flex; take measurements from `segment-timeline__timeline-container` instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks OK.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
A feature called Budget Duration
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Parts have a new optional property called
budgetDuration
.In a Segment that has any Part with
budgetDuration
set, an Editorial Marker will be displayed on the segment timeline, as a dashed vertical line, indicating the budget duration of the entire Segment (sum ofbudgetDurations
of its Parts).In said Segment, the SegmentDuration component will display the segment's budget duration, and count down from it when the segment becomes live. The duration will go negative when the segment is playing longer than its budget.
If a segment with budget duration is on air, Part Counters on the next Segments are based on budget duration of the current segment, instead of expected durations of the parts that are left.
Other information:
Status