fix(LSG): make current segment timing consider partInstances#1612
fix(LSG): make current segment timing consider partInstances#1612ianshade wants to merge 2 commits intoSofie-Automation:mainfrom
Conversation
WalkthroughThe changes enhance segment timing calculation by introducing a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
About the Contributor
This pull request is posted on behalf of TV 2 Norge.
Type of Contribution
This is a:
Bug fix
Current Behavior
The
calculateSegmentTiming()function in the Live Status Gateway did not consider part instance durations when calculating segment timing. It only used the original part definitions, which meant that if part durations were modified during playout on part instances, these changes were not reflected in the segment timing calculations the same way as they would be in the Sofie GUI.New Behavior
The
calculateSegmentTiming()function now accepts asegmentPartInstancesparameter. When calculating the total duration, it checks if a matching part instance exists and uses the instance's part duration instead of the original part duration. If no instance exists for a part, it falls back to the original part definition.This ensures that current segment timing correctly reflects any duration modifications made to parts through their instances during playout.
Testing
Affected areas
Time Frame
Other Information
Status
Summary
This PR fixes a bug in the Live Status Gateway's segment timing calculation to account for duration modifications made to parts at runtime via part instances. Previously,
calculateSegmentTiming()only considered the original part definitions, missing any duration changes applied during playout. The fix introduces asegmentPartInstancesparameter that enables duration lookups from part instances when available, with fallback to the original part definition.Changes
segmentTiming.ts (10 lines changed):
unprotectStringand underscore utilitiescalculateSegmentTiming()signature to acceptsegmentPartInstances: DBPartInstance[]parameterindexBymethodcalculateCurrentSegmentTiming()now passessegmentPartInstancestocalculateSegmentTiming()segmentTiming.test.ts (53 lines added):
segmentsTopic.ts (1 line changed):
calculateSegmentTiming()inSegmentsTopic.sendStatus()to pass an empty array forsegmentPartInstancesImpact
The change enables the Live Status Gateway to accurately reflect segment timing when part durations are modified via part instances during playout, improving timing accuracy for current segment calculations. The fix includes comprehensive unit test coverage for both primary use case (instance duration used) and fallback behavior (original duration used).