mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 14:14:17 +00:00
fix(report): measure events against the schedule they ran on
The runtime report joined live report data against the current rundown, so editing an event after the show silently rewrote the report of a show that had already happened. Durations, and the over/under chip in the rundown, would change to match the edit. Each event now records the schedule it actually ran on, and the report is read from that. - OntimeEventReport carries scheduledStart and scheduledDuration, captured when the event starts, plus a playCount so an event started twice no longer overwrites its own record without trace. - The over/under calculation moves to ontime-utils, where the rundown chip and the settings panel share one implementation instead of deriving it separately and disagreeing. - The report panel gains a summary of the show: planned against actual, drift, and how many events landed over, under or on time. - Export CSV was rendering a trash bin icon. No change to how or where anything is stored: the report stays in memory exactly as before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019nr3FbLbM8gB8Jm771YgTV
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import { OntimeReport, OpenRun, ShowRun, ShowRunSummary } from 'ontime-types';
|
||||
import { OntimeReport } from 'ontime-types';
|
||||
|
||||
import { ontimeQueryClient } from '../../common/queryClient';
|
||||
import { REPORT, apiEntryUrl } from './constants';
|
||||
@@ -24,49 +24,3 @@ export async function deleteAllReport() {
|
||||
await axios.delete(`${reportUrl}/all`);
|
||||
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT });
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP request to fetch the run history, optionally scoped to a rundown
|
||||
*/
|
||||
export async function fetchRuns(rundownId?: string, options?: RequestOptions): Promise<ShowRunSummary[]> {
|
||||
const res = await axios.get(`${reportUrl}/runs`, {
|
||||
signal: options?.signal,
|
||||
params: rundownId ? { rundownId } : undefined,
|
||||
});
|
||||
return res.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP request to fetch a single run, including its per event data
|
||||
*/
|
||||
export async function fetchRun(id: string, options?: RequestOptions): Promise<ShowRun> {
|
||||
const res = await axios.get(`${reportUrl}/runs/${id}`, { signal: options?.signal });
|
||||
return res.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP request to fetch the run being recorded
|
||||
* @returns null when no run is in progress
|
||||
*/
|
||||
export async function fetchOpenRun(options?: RequestOptions): Promise<OpenRun | null> {
|
||||
try {
|
||||
const res = await axios.get(`${reportUrl}/runs/open`, { signal: options?.signal });
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 404) {
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function renameRun(id: string, label: string): Promise<ShowRun> {
|
||||
const res = await axios.patch(`${reportUrl}/runs/${id}`, { label });
|
||||
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT });
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function deleteRun(id: string) {
|
||||
await axios.delete(`${reportUrl}/runs/${id}`);
|
||||
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user