mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-15 02:53:07 +00:00
refactor: small fixes and style tweaks
fix: prevent reflow on editing images fix: schedule overview fix: report on all events refactor: over-under time colours fix: prevent edit on delete
This commit is contained in:
committed by
Carlos Valente
parent
1e1f547ce1
commit
ad2ef3b53f
@@ -4,6 +4,7 @@ import { makeCSVFromArrayOfArrays } from '../../../../common/utils/csv';
|
||||
import { formatTime } from '../../../../common/utils/time';
|
||||
|
||||
export type CombinedReport = {
|
||||
id: EntryId;
|
||||
index: number;
|
||||
title: string;
|
||||
cue: string;
|
||||
@@ -16,24 +17,48 @@ export type CombinedReport = {
|
||||
/**
|
||||
* Creates a combined report with the rundown data
|
||||
*/
|
||||
export function getCombinedReport(report: OntimeReport, rundown: RundownEntries, order: EntryId[]): CombinedReport[] {
|
||||
export function getCombinedReport(
|
||||
report: OntimeReport,
|
||||
rundown: RundownEntries,
|
||||
flatOrder: EntryId[],
|
||||
): CombinedReport[] {
|
||||
if (Object.keys(report).length === 0) return [];
|
||||
if (order.length === 0) return [];
|
||||
if (flatOrder.length === 0) return [];
|
||||
|
||||
const combinedReport: CombinedReport[] = [];
|
||||
|
||||
for (const [key, value] of Object.entries(report)) {
|
||||
if (!rundown[key] || !isOntimeEvent(rundown[key])) continue;
|
||||
let index = 1;
|
||||
for (let i = 0; i < flatOrder.length; i++) {
|
||||
const id = flatOrder[i];
|
||||
const entry = rundown[id];
|
||||
if (!entry || !isOntimeEvent(entry)) continue;
|
||||
|
||||
combinedReport.push({
|
||||
index: order.findIndex((id) => id === key),
|
||||
title: rundown[key].title,
|
||||
cue: rundown[key].cue,
|
||||
scheduledStart: rundown[key].timeStart,
|
||||
actualEnd: value.endedAt,
|
||||
scheduledEnd: rundown[key].timeEnd,
|
||||
actualStart: value.startedAt,
|
||||
});
|
||||
if (!(id in report)) {
|
||||
combinedReport.push({
|
||||
id: id,
|
||||
index: index,
|
||||
title: entry.title,
|
||||
cue: entry.cue,
|
||||
scheduledStart: entry.timeStart,
|
||||
actualEnd: null,
|
||||
scheduledEnd: entry.timeEnd,
|
||||
actualStart: null,
|
||||
});
|
||||
}
|
||||
|
||||
if (id in report) {
|
||||
combinedReport.push({
|
||||
id: id,
|
||||
index: index,
|
||||
title: entry.title,
|
||||
cue: entry.cue,
|
||||
scheduledStart: entry.timeStart,
|
||||
actualEnd: report[id].endedAt,
|
||||
scheduledEnd: entry.timeEnd,
|
||||
actualStart: report[id].startedAt,
|
||||
});
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return combinedReport;
|
||||
|
||||
Reference in New Issue
Block a user