refactor: gather group metadata

This commit is contained in:
Carlos Valente
2025-03-28 19:16:38 +01:00
committed by Carlos Valente
parent 730cb95c04
commit 876d111c61
48 changed files with 1044 additions and 751 deletions
@@ -97,9 +97,7 @@ export const useEventAction = () => {
linkPrevious: options?.linkPrevious ?? linkPrevious,
};
if (applicationOptions.linkPrevious && applicationOptions?.lastEventId) {
newEvent.linkStart = applicationOptions.lastEventId;
} else if (applicationOptions?.lastEventId) {
if (applicationOptions?.lastEventId) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know this is a value
const rundownData = queryClient.getQueryData<Rundown>(RUNDOWN)!;
const previousEvent = rundownData.entries[applicationOptions.lastEventId];
@@ -109,9 +107,8 @@ export const useEventAction = () => {
}
// Override event with options from editor settings
if (applicationOptions.defaultPublic) {
newEvent.isPublic = true;
}
newEvent.linkStart = applicationOptions.linkPrevious;
newEvent.isPublic = applicationOptions.defaultPublic;
if (newEvent.duration === undefined && newEvent.timeEnd === undefined) {
newEvent.duration = parseUserTime(defaultDuration);
@@ -263,7 +260,7 @@ export const useEventAction = () => {
newEvent.duration = value === '' ? undefined : calculateNewValue();
} else if (field === 'timeStart') {
// an empty values means we should link to the previous
newEvent.linkStart = value === '' ? 'true' : null;
newEvent.linkStart = value === '';
newEvent.timeStart = value === '' ? undefined : calculateNewValue();
}
} else {
@@ -15,7 +15,8 @@ describe('cloneEvent()', () => {
timeEnd: 10,
timerType: TimerType.CountDown,
timeStrategy: TimeStrategy.LockEnd,
linkStart: null,
currentBlock: 'test',
linkStart: false,
countToEnd: false,
endAction: EndAction.None,
isPublic: false,
@@ -45,6 +46,7 @@ describe('cloneEvent()', () => {
timeEnd: original.timeEnd,
timerType: original.timerType,
timeStrategy: original.timeStrategy,
currentBlock: 'test',
countToEnd: original.countToEnd,
linkStart: original.linkStart,
endAction: original.endAction,