mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 00:43:54 +00:00
fill Dependency List
This commit is contained in:
@@ -371,19 +371,6 @@ function useEntryActionsForRundown(scopedRundownId: string | undefined) {
|
||||
[getCurrentRundownData, updateEntryMutation],
|
||||
);
|
||||
|
||||
const matchGroupDuration = useCallback(async (eventId: EntryId, groupId: EntryId) => {
|
||||
const rundown = queryClient.getQueryData<Rundown>(RUNDOWN);
|
||||
if (!rundown) return;
|
||||
const group = rundown.entries[groupId];
|
||||
if (!group || !isOntimeGroup(group) || group.targetDuration === null) return;
|
||||
const event = rundown.entries[eventId];
|
||||
if (!event || !isOntimeEvent(event)) return;
|
||||
const durationDiff = group.targetDuration - group.duration;
|
||||
const newDuration = event.duration + durationDiff;
|
||||
if (newDuration < 0) return;
|
||||
updateTimer(eventId, 'duration', String(newDuration / MILLIS_PER_SECOND) + 's', false);
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Updates time of existing event
|
||||
* @param eventId {EntryId} - id of the event
|
||||
@@ -479,7 +466,28 @@ function useEntryActionsForRundown(scopedRundownId: string | undefined) {
|
||||
return previousEnd;
|
||||
}
|
||||
},
|
||||
[getCurrentRundownData, updateEntryMutation, queryClient],
|
||||
[getCurrentRundownData, updateEntryMutation, queryClient, resolveCurrentRundownQueryKey],
|
||||
);
|
||||
|
||||
/**
|
||||
* Updates time of existing event so it satisfies the group target duration
|
||||
* @param eventId {EntryId} - id of the event
|
||||
* @param groupId {EntryId} - id of the enclosing group
|
||||
*/
|
||||
const matchGroupDuration = useCallback(
|
||||
async (eventId: EntryId, groupId: EntryId) => {
|
||||
const rundown = queryClient.getQueryData<Rundown>(resolveCurrentRundownQueryKey());
|
||||
if (!rundown) return;
|
||||
const group = rundown.entries[groupId];
|
||||
if (!group || !isOntimeGroup(group) || group.targetDuration === null) return;
|
||||
const event = rundown.entries[eventId];
|
||||
if (!event || !isOntimeEvent(event)) return;
|
||||
const durationDiff = group.targetDuration - group.duration;
|
||||
const newDuration = event.duration + durationDiff;
|
||||
if (newDuration < 0) return;
|
||||
updateTimer(eventId, 'duration', String(newDuration / MILLIS_PER_SECOND) + 's', false);
|
||||
},
|
||||
[queryClient, updateTimer, resolveCurrentRundownQueryKey],
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user