mirror of
https://github.com/cpvalente/ontime.git
synced 2026-07-26 10:38:55 +00:00
refactor: remove trivially inferred numEvents
This commit is contained in:
committed by
Carlos Valente
parent
f68b3bf057
commit
b0e42811a5
@@ -792,7 +792,6 @@ function optimisticDeleteEntries(entryIds: EntryId[], rundown: Rundown) {
|
||||
} else {
|
||||
const parent = entries[entry.parent] as OntimeBlock;
|
||||
parent.events = parent.events.filter((event) => event !== entry.id);
|
||||
parent.numEvents -= 1;
|
||||
}
|
||||
|
||||
delete entries[entry.id];
|
||||
|
||||
@@ -134,7 +134,7 @@ export default function BlockBlock(props: BlockBlockProps) {
|
||||
</div>
|
||||
<div className={style.metaEntry}>
|
||||
<div>Events</div>
|
||||
<div>{data.numEvents}</div>
|
||||
<div>{data.events.length}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -90,7 +90,6 @@ export function createBlock(patch?: Partial<OntimeBlock>): OntimeBlock {
|
||||
endTime: null,
|
||||
duration: 0,
|
||||
isFirstLinked: false,
|
||||
numEvents: patch.events?.length ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ export const demoDb: DatabaseModel = {
|
||||
endTime: null,
|
||||
duration: 0,
|
||||
isFirstLinked: false,
|
||||
numEvents: 0,
|
||||
custom: {
|
||||
song: 'Sekret',
|
||||
artist: 'Ronela Hajati',
|
||||
@@ -219,7 +218,6 @@ export const demoDb: DatabaseModel = {
|
||||
endTime: null,
|
||||
duration: 0,
|
||||
isFirstLinked: false,
|
||||
numEvents: 0,
|
||||
},
|
||||
'1c420': {
|
||||
type: SupportedEntry.Event,
|
||||
@@ -382,7 +380,6 @@ export const demoDb: DatabaseModel = {
|
||||
endTime: null,
|
||||
duration: 0,
|
||||
isFirstLinked: false,
|
||||
numEvents: 0,
|
||||
},
|
||||
'503c4': {
|
||||
type: SupportedEntry.Event,
|
||||
|
||||
@@ -54,5 +54,4 @@ export const block: Omit<OntimeBlock, 'id'> = {
|
||||
endTime: null, // calculated at runtime
|
||||
duration: 0, // calculated at runtime
|
||||
isFirstLinked: false, // calculated at runtime
|
||||
numEvents: 0, // calculated at runtime
|
||||
};
|
||||
|
||||
@@ -550,7 +550,6 @@ describe('generate() v4', () => {
|
||||
endTime: 400,
|
||||
duration: 300,
|
||||
isFirstLinked: false,
|
||||
numEvents: 3,
|
||||
},
|
||||
'100': { type: SupportedEntry.Event, parent: '1' },
|
||||
'200': { type: SupportedEntry.Event, parent: '1' },
|
||||
@@ -591,7 +590,6 @@ describe('generate() v4', () => {
|
||||
endTime: 400,
|
||||
duration: 300,
|
||||
isFirstLinked: false,
|
||||
numEvents: 3,
|
||||
},
|
||||
'101': { parent: '1', gap: 90, linkStart: false },
|
||||
'102': { parent: '1' },
|
||||
@@ -603,7 +601,6 @@ describe('generate() v4', () => {
|
||||
endTime: 800,
|
||||
duration: 300,
|
||||
isFirstLinked: false,
|
||||
numEvents: 3,
|
||||
},
|
||||
'201': { id: '201', timeStart: 500, timeEnd: 600, duration: 100, gap: 100, linkStart: false },
|
||||
'202': { id: '202', timeStart: 600, timeEnd: 700, duration: 100 },
|
||||
@@ -615,7 +612,6 @@ describe('generate() v4', () => {
|
||||
endTime: 1200,
|
||||
duration: 300,
|
||||
isFirstLinked: false,
|
||||
numEvents: 3,
|
||||
},
|
||||
'301': { id: '301', timeStart: 900, timeEnd: 1000, duration: 100, gap: 100, linkStart: false },
|
||||
'302': { id: '302', timeStart: 1000, timeEnd: 1100, duration: 100 },
|
||||
|
||||
@@ -169,7 +169,6 @@ export function generate(
|
||||
processedEntry.endTime = blockEndTime;
|
||||
processedEntry.isFirstLinked = isFirstLinked;
|
||||
processedEntry.events = blockEvents;
|
||||
processedEntry.numEvents = blockEvents.length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +415,6 @@ export function remove({ rundown, eventIds }: RemoveArgs): MutatingReturn {
|
||||
eventId: entry.parent,
|
||||
patch: {
|
||||
events: parentEvents,
|
||||
numEvents: parentEvents.length,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/**
|
||||
* This CSS file allows user customisation of the UI
|
||||
* We expose some CSS properties to facilitate this (see below in :root)
|
||||
|
||||
@@ -180,8 +180,7 @@
|
||||
"startTime": null,
|
||||
"endTime": null,
|
||||
"duration": 0,
|
||||
"isFirstLinked": false,
|
||||
"numEvents": 0
|
||||
"isFirstLinked": false
|
||||
},
|
||||
"1c420": {
|
||||
"type": "event",
|
||||
|
||||
Vendored
+2
-4
@@ -180,8 +180,7 @@
|
||||
"startTime": null,
|
||||
"endTime": null,
|
||||
"duration": 0,
|
||||
"isFirstLinked": false,
|
||||
"numEvents": 0
|
||||
"isFirstLinked": false
|
||||
},
|
||||
"1c420": {
|
||||
"type": "event",
|
||||
@@ -341,8 +340,7 @@
|
||||
"startTime": null,
|
||||
"endTime": null,
|
||||
"duration": 0,
|
||||
"isFirstLinked": false,
|
||||
"numEvents": 0
|
||||
"isFirstLinked": false
|
||||
},
|
||||
"503c4": {
|
||||
"type": "event",
|
||||
|
||||
@@ -33,7 +33,6 @@ export type OntimeBlock = OntimeBaseEvent & {
|
||||
endTime: MaybeNumber; // calculated at runtime
|
||||
duration: number; // calculated at runtime
|
||||
isFirstLinked: boolean; // calculated at runtime, whether the first event is linked
|
||||
numEvents: number; // calculated at runtime
|
||||
};
|
||||
|
||||
export type OntimeEvent = OntimeBaseEvent & {
|
||||
|
||||
Reference in New Issue
Block a user