mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 07:29:08 +00:00
limit to max duration
This commit is contained in:
@@ -705,4 +705,13 @@ describe('eventDurationMatchGroupTarget()', () => {
|
|||||||
});
|
});
|
||||||
expect(result).toStrictEqual(null);
|
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,
|
generateId,
|
||||||
getCueCandidate,
|
getCueCandidate,
|
||||||
makeString,
|
makeString,
|
||||||
|
maxDuration,
|
||||||
validateEndAction,
|
validateEndAction,
|
||||||
validateTimerType,
|
validateTimerType,
|
||||||
validateTimes,
|
validateTimes,
|
||||||
@@ -624,5 +625,5 @@ export function eventDurationMatchGroupTarget({
|
|||||||
if (targetDuration === groupDuration) return null;
|
if (targetDuration === groupDuration) return null;
|
||||||
const durationDiff = targetDuration - groupDuration;
|
const durationDiff = targetDuration - groupDuration;
|
||||||
const newDuration = eventDuration + durationDiff;
|
const newDuration = eventDuration + durationDiff;
|
||||||
return newDuration < 0 ? null : newDuration;
|
return newDuration < 0 || newDuration > maxDuration ? null : newDuration;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user