mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 17:33:55 +00:00
limit to max duration
This commit is contained in:
@@ -705,4 +705,13 @@ describe('eventDurationMatchGroupTarget()', () => {
|
||||
});
|
||||
expect(result).toStrictEqual(null);
|
||||
});
|
||||
|
||||
it('returns null when duration would be over 24h', () => {
|
||||
const result = eventDurationMatchGroupTarget({
|
||||
targetDuration: 30 * MILLIS_PER_HOUR,
|
||||
groupDuration: MILLIS_PER_HOUR,
|
||||
eventDuration: MILLIS_PER_MINUTE * 30,
|
||||
});
|
||||
expect(result).toStrictEqual(null);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
generateId,
|
||||
getCueCandidate,
|
||||
makeString,
|
||||
maxDuration,
|
||||
validateEndAction,
|
||||
validateTimerType,
|
||||
validateTimes,
|
||||
@@ -624,5 +625,5 @@ export function eventDurationMatchGroupTarget({
|
||||
if (targetDuration === groupDuration) return null;
|
||||
const durationDiff = targetDuration - groupDuration;
|
||||
const newDuration = eventDuration + durationDiff;
|
||||
return newDuration < 0 ? null : newDuration;
|
||||
return newDuration < 0 || newDuration > maxDuration ? null : newDuration;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user