mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 12:23:51 +00:00
refactor: create transaction system and apply to adding entry (#1620)
* refactor: create transaction system and apply to adding entry * refactor: migrate edit mutations to transaction * refactor: migrate delete mutation to transaction * refactor: migrate reorder mutation to transaction * refactor: migrate apply delay to transaction * refactor: migrate swapEvents to transaction * refactor: migrate clone to transaction * refactor: migrate group/ungroup transactions * refactor: simplify mutations * refactor: migrate getters * chore: add tests to processRundown()
This commit is contained in:
@@ -40,7 +40,7 @@ describe('getCueCandidate()', () => {
|
||||
'1': { id: '1', cue: '10', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', cue: '11', type: SupportedEntry.Event } as OntimeEvent,
|
||||
};
|
||||
const cue = getCueCandidate(entries, ['1', '2']);
|
||||
const cue = getCueCandidate(entries, ['1', '2'], null);
|
||||
expect(cue).toBe('1');
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ describe('getCueCandidate()', () => {
|
||||
'1': { id: '1', cue: '1', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', cue: '10', type: SupportedEntry.Event } as OntimeEvent,
|
||||
};
|
||||
const cue = getCueCandidate(entries, ['1', '2']);
|
||||
const cue = getCueCandidate(entries, ['1', '2'], null);
|
||||
expect(cue).toBe('0.1');
|
||||
});
|
||||
});
|
||||
@@ -124,7 +124,7 @@ describe('findCueName() with mixed events', () => {
|
||||
'1': { id: '1', cue: '10', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', cue: '11', type: SupportedEntry.Event } as OntimeEvent,
|
||||
};
|
||||
const cue = getCueCandidate(entries, ['1', '2']);
|
||||
const cue = getCueCandidate(entries, ['1', '2'], null);
|
||||
expect(cue).toBe('1');
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('findCueName() with mixed events', () => {
|
||||
'1': { id: '1', cue: '1', type: SupportedEntry.Event } as OntimeEvent,
|
||||
'2': { id: '2', cue: '10', type: SupportedEntry.Event } as OntimeEvent,
|
||||
};
|
||||
const cue = getCueCandidate(entries, ['1', '2']);
|
||||
const cue = getCueCandidate(entries, ['1', '2'], null);
|
||||
expect(cue).toBe('0.1');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,9 +41,9 @@ export function getIncrement(input: string): string {
|
||||
/**
|
||||
* Gets suitable name for a new event cue
|
||||
*/
|
||||
export function getCueCandidate(entries: RundownEntries, order: EntryId[], insertAfterId?: string): string {
|
||||
export function getCueCandidate(entries: RundownEntries, order: EntryId[], insertAfterId: EntryId | null): string {
|
||||
// we did not provide a element to go after, we attempt to go first so only need to check for a cue with value 1
|
||||
if (insertAfterId === undefined || order.length === 0) {
|
||||
if (insertAfterId === null || order.length === 0) {
|
||||
return addAtTop();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user