mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 18:33:53 +00:00
Custom fields views (#789)
* style: show field colour in editor * feat: custom fields in cuesheet * feat: custom fields in operator * refactor: update CSV export
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
|
||||
import { data, db } from '../../modules/loadDb.js';
|
||||
import { safeMerge } from './DataProvider.utils.js';
|
||||
import { isProduction } from '../../setup.js';
|
||||
import { isTest } from '../../setup.js';
|
||||
|
||||
export class DataProvider {
|
||||
static getData() {
|
||||
@@ -110,7 +110,7 @@ export class DataProvider {
|
||||
}
|
||||
|
||||
static async persist() {
|
||||
if (!isProduction) {
|
||||
if (isTest) {
|
||||
return;
|
||||
}
|
||||
await db.write();
|
||||
|
||||
@@ -220,6 +220,7 @@ export function mutateCache<T extends object>(mutation: MutatingFn<T>) {
|
||||
// TODO: should we trottle this?
|
||||
// defer writing to the database
|
||||
setImmediate(() => {
|
||||
console.log('writing to database', persistedRundown.length)
|
||||
DataProvider.setRundown(persistedRundown);
|
||||
});
|
||||
|
||||
@@ -283,7 +284,6 @@ export function edit({ persistedRundown, eventId, patch }: EditArgs): Required<M
|
||||
|
||||
const eventInMemory = persistedRundown[indexAt];
|
||||
const newEvent = makeEvent(eventInMemory, patch);
|
||||
console.log('got', patch, 'will make', newEvent);
|
||||
|
||||
const newRundown = [...persistedRundown];
|
||||
newRundown[indexAt] = newEvent;
|
||||
|
||||
@@ -402,7 +402,7 @@ export function createPatch(originalEvent: OntimeEvent, patchEvent: Partial<Onti
|
||||
revision: originalEvent.revision,
|
||||
timeWarning: patchEvent.timeWarning ?? originalEvent.timeWarning,
|
||||
timeDanger: patchEvent.timeDanger ?? originalEvent.timeDanger,
|
||||
custom: patchEvent.custom ?? originalEvent.custom,
|
||||
custom: { ...originalEvent.custom, ...patchEvent.custom },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user