mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 03:43:50 +00:00
chore: rename blocks to groups
This commit is contained in:
committed by
Carlos Valente
parent
486d89ecf4
commit
e5d2457717
@@ -12,7 +12,7 @@ export type RestorePoint = {
|
||||
addedTime: number;
|
||||
pausedAt: MaybeNumber;
|
||||
firstStart: MaybeNumber;
|
||||
blockStartAt: MaybeNumber;
|
||||
groupStartAt: MaybeNumber;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ export function isRestorePoint(obj: unknown): obj is RestorePoint {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof restorePoint.blockStartAt !== 'number' && restorePoint.blockStartAt !== null) {
|
||||
if (typeof restorePoint.groupStartAt !== 'number' && restorePoint.groupStartAt !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('isRestorePoint()', () => {
|
||||
addedTime: 2,
|
||||
pausedAt: 3,
|
||||
firstStart: 1,
|
||||
blockStartAt: 10,
|
||||
groupStartAt: 10,
|
||||
};
|
||||
expect(isRestorePoint(restorePoint)).toBe(true);
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('isRestorePoint()', () => {
|
||||
addedTime: 0,
|
||||
pausedAt: null,
|
||||
firstStart: 1,
|
||||
blockStartAt: null,
|
||||
groupStartAt: null,
|
||||
};
|
||||
expect(isRestorePoint(restorePoint)).toBe(true);
|
||||
});
|
||||
@@ -38,7 +38,7 @@ describe('isRestorePoint()', () => {
|
||||
startedAt: null,
|
||||
addedTime: 0,
|
||||
pausedAt: null,
|
||||
blockStartAt: 10,
|
||||
groupStartAt: 10,
|
||||
};
|
||||
expect(isRestorePoint(restorePoint)).toBe(false);
|
||||
});
|
||||
@@ -48,7 +48,7 @@ describe('isRestorePoint()', () => {
|
||||
startedAt: null,
|
||||
addedTime: 0,
|
||||
pausedAt: null,
|
||||
blockStartAt: 10,
|
||||
groupStartAt: 10,
|
||||
};
|
||||
expect(isRestorePoint(restorePoint)).toBe(false);
|
||||
});
|
||||
@@ -59,7 +59,7 @@ describe('isRestorePoint()', () => {
|
||||
startedAt: 'testing',
|
||||
addedTime: 0,
|
||||
pausedAt: null,
|
||||
blockStartAt: 10,
|
||||
groupStartAt: 10,
|
||||
};
|
||||
expect(isRestorePoint(restorePoint)).toBe(false);
|
||||
});
|
||||
@@ -76,7 +76,7 @@ describe('RestoreService()', () => {
|
||||
addedTime: 5678,
|
||||
pausedAt: 9087,
|
||||
firstStart: 1234,
|
||||
blockStartAt: 1652,
|
||||
groupStartAt: 1652,
|
||||
};
|
||||
|
||||
const restoreService = new RestoreService('/path/to/restore/file');
|
||||
@@ -94,7 +94,7 @@ describe('RestoreService()', () => {
|
||||
addedTime: 0,
|
||||
pausedAt: null,
|
||||
firstStart: 1234,
|
||||
blockStartAt: null,
|
||||
groupStartAt: null,
|
||||
};
|
||||
|
||||
const restoreService = new RestoreService('/path/to/restore/file');
|
||||
@@ -112,7 +112,7 @@ describe('RestoreService()', () => {
|
||||
addedTime: 1234,
|
||||
pausedAt: 1234,
|
||||
firstStart: 1234,
|
||||
blockStartAt: 10,
|
||||
groupStartAt: 10,
|
||||
};
|
||||
|
||||
const restoreService = new RestoreService('/path/to/restore/file');
|
||||
@@ -132,7 +132,7 @@ describe('RestoreService()', () => {
|
||||
addedTime: 1234,
|
||||
pausedAt: 1234,
|
||||
firstStart: 1234,
|
||||
blockStartAt: null,
|
||||
groupStartAt: null,
|
||||
};
|
||||
|
||||
const restoreService = new RestoreService('/path/to/restore/file');
|
||||
|
||||
@@ -716,9 +716,9 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
!deepEqual(RuntimeService.previousState?.runtime, state.runtime);
|
||||
|
||||
// TODO: the value shows up one tick to late
|
||||
const shouldBlockUpdate =
|
||||
!deepEqual(RuntimeService?.previousState.blockNow, state.blockNow) ||
|
||||
RuntimeService?.previousState.blockNext !== state.blockNext;
|
||||
const shouldGroupUpdate =
|
||||
!deepEqual(RuntimeService?.previousState.groupNow, state.groupNow) ||
|
||||
RuntimeService?.previousState.groupNext !== state.groupNext;
|
||||
|
||||
// TODO: the value shows up one tick to late
|
||||
const shouldNextFlagUpdate = !deepEqual(RuntimeService?.previousState?.nextFlag, state.nextFlag);
|
||||
@@ -728,7 +728,7 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
* so if any of them are updated we also need to send the clock
|
||||
* in case nothing else is updating the clock will be updated at the notification rate
|
||||
*/
|
||||
const shouldUpdateClock = shouldRuntimeUpdate || shouldBlockUpdate || normalClockUpdate;
|
||||
const shouldUpdateClock = shouldRuntimeUpdate || shouldGroupUpdate || normalClockUpdate;
|
||||
|
||||
// Now we set all the updates on the eventstore and update the previous value
|
||||
if (shouldUpdateTimer) {
|
||||
@@ -744,11 +744,11 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
RuntimeService.previousState.runtime = structuredClone(state.runtime);
|
||||
}
|
||||
|
||||
if (shouldBlockUpdate) {
|
||||
batch.add('blockNow', state.blockNow);
|
||||
batch.add('blockNext', state.blockNext);
|
||||
RuntimeService.previousState.blockNow = structuredClone(state.blockNow);
|
||||
RuntimeService.previousState.blockNext = state.blockNext;
|
||||
if (shouldGroupUpdate) {
|
||||
batch.add('groupNow', state.groupNow);
|
||||
batch.add('groupNext', state.groupNext);
|
||||
RuntimeService.previousState.groupNow = structuredClone(state.groupNow);
|
||||
RuntimeService.previousState.groupNext = structuredClone(state.groupNext);
|
||||
}
|
||||
|
||||
if (shouldNextFlagUpdate) {
|
||||
@@ -808,7 +808,7 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
addedTime: state.timer.addedTime,
|
||||
pausedAt: state._timer.pausedAt,
|
||||
firstStart: state.runtime.actualStart,
|
||||
blockStartAt: state.blockNow?.startedAt ?? null,
|
||||
groupStartAt: state.groupNow?.startedAt ?? null,
|
||||
})
|
||||
.catch((_e) => {
|
||||
//we don't do anything with the error here
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isOntimeBlock, isOntimeEvent, OntimeEvent, OntimeEntry, RGBColour } from 'ontime-types';
|
||||
import { isOntimeGroup, isOntimeEvent, OntimeEvent, OntimeEntry, RGBColour } from 'ontime-types';
|
||||
import { cssOrHexToColour, isLightColour, millisToString, mixColours } from 'ontime-utils';
|
||||
|
||||
import type { sheets_v4 } from '@googleapis/sheets';
|
||||
@@ -100,7 +100,7 @@ export function cellRequestFromEvent(
|
||||
}
|
||||
}
|
||||
|
||||
const colors = isOntimeEvent(event) || isOntimeBlock(event) ? getAccessibleColour(event.colour) : undefined;
|
||||
const colors = isOntimeEvent(event) || isOntimeGroup(event) ? getAccessibleColour(event.colour) : undefined;
|
||||
const cellColor: sheets_v4.Schema$CellData = !colors
|
||||
? {}
|
||||
: {
|
||||
@@ -163,12 +163,12 @@ function getCellData(key: keyof OntimeEvent | 'blank', event: OntimeEntry) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isOntimeBlock(event)) {
|
||||
if (isOntimeGroup(event)) {
|
||||
if (key === 'title') {
|
||||
return { userEnteredValue: { stringValue: event[key] } };
|
||||
}
|
||||
if (key === 'timerType') {
|
||||
return { userEnteredValue: { stringValue: 'block' } };
|
||||
return { userEnteredValue: { stringValue: 'group' } };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user