Export complete Ontime spreadsheet event columns
This commit is contained in:
parent
2c3e3c3c00
commit
9804869ea2
|
|
@ -15,7 +15,7 @@ use std::{
|
|||
use zip::{ZipWriter, write::SimpleFileOptions};
|
||||
|
||||
// Match the official Ontime v4 spreadsheet template (not the JSON property names).
|
||||
const SPREADSHEET_HEADERS: [&str; 7] = [
|
||||
const SPREADSHEET_HEADERS: [&str; 16] = [
|
||||
"Time Start",
|
||||
"Time End",
|
||||
"Duration",
|
||||
|
|
@ -23,6 +23,15 @@ const SPREADSHEET_HEADERS: [&str; 7] = [
|
|||
"Title",
|
||||
"Note",
|
||||
"Timer Type",
|
||||
"Link Start",
|
||||
"Colour",
|
||||
"ID",
|
||||
"Flag",
|
||||
"Count to end",
|
||||
"End Action",
|
||||
"Warning Time",
|
||||
"Danger Time",
|
||||
"Skip",
|
||||
];
|
||||
|
||||
fn entry_values(entry: &Entry, rundown: &Rundown, usage: &str, column: Option<&str>) -> String {
|
||||
|
|
@ -123,6 +132,15 @@ fn worksheet(rundown: &Rundown) -> String {
|
|||
entry.title.clone(),
|
||||
entry_values(entry, rundown, "notes", None),
|
||||
"count-down".into(),
|
||||
"FALSE".into(), // Ontime otherwise links events, removing intentional gaps.
|
||||
"#5744b5".into(),
|
||||
entry.id.clone(),
|
||||
"FALSE".into(),
|
||||
"FALSE".into(),
|
||||
"none".into(),
|
||||
display(120000.min(entry.duration_ms / 5)),
|
||||
display(60000.min(entry.duration_ms / 10)),
|
||||
"FALSE".into(),
|
||||
];
|
||||
row.extend(
|
||||
metadata
|
||||
|
|
|
|||
|
|
@ -693,6 +693,15 @@ fn xlsx_export_has_ontime_columns_notes_metadata_and_clock_strings() {
|
|||
"Title",
|
||||
"Note",
|
||||
"Timer Type",
|
||||
"Link Start",
|
||||
"Colour",
|
||||
"ID",
|
||||
"Flag",
|
||||
"Count to end",
|
||||
"End Action",
|
||||
"Warning Time",
|
||||
"Danger Time",
|
||||
"Skip",
|
||||
"Video",
|
||||
]
|
||||
);
|
||||
|
|
@ -701,9 +710,40 @@ fn xlsx_export_has_ontime_columns_notes_metadata_and_clock_strings() {
|
|||
assert_eq!(tables[0].rows[1][2].text, "00:05:00");
|
||||
assert_eq!(tables[0].rows[1][5].text, "Ready & <go>");
|
||||
assert_eq!(tables[0].rows[1][6].text, "count-down");
|
||||
assert_eq!(tables[0].rows[1][7].text, "Slides");
|
||||
assert_eq!(tables[0].rows[1][16].text, "Slides");
|
||||
assert_eq!(tables[0].rows[2][0].text, "09:10:00");
|
||||
|
||||
// Keep XLSX playback settings identical to JSON, including unlinked starts
|
||||
// on both sides of an intentional gap and duration-scaled warning thresholds.
|
||||
let json = export::ontime(analysis.rundown.as_ref().unwrap()).unwrap();
|
||||
let events = &json["rundowns"]["default"]["entries"];
|
||||
for row in &tables[0].rows[1..] {
|
||||
let event = &events[&row[9].text];
|
||||
assert_eq!(row[7].text, "FALSE");
|
||||
for (column, key) in [
|
||||
(7, "linkStart"),
|
||||
(10, "flag"),
|
||||
(11, "countToEnd"),
|
||||
(15, "skip"),
|
||||
] {
|
||||
assert_eq!(row[column].text == "TRUE", event[key].as_bool().unwrap());
|
||||
}
|
||||
for (column, key) in [
|
||||
(5, "note"),
|
||||
(6, "timerType"),
|
||||
(8, "colour"),
|
||||
(12, "endAction"),
|
||||
] {
|
||||
assert_eq!(row[column].text, event[key].as_str().unwrap());
|
||||
}
|
||||
for (column, key) in [(13, "timeWarning"), (14, "timeDanger")] {
|
||||
assert_eq!(
|
||||
row[column].text,
|
||||
rundown_converter::time::display(event[key].as_i64().unwrap())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Metadata must not shadow Ontime's standard timing fields.
|
||||
let mut rundown = analysis.rundown.unwrap();
|
||||
rundown
|
||||
|
|
@ -713,7 +753,7 @@ fn xlsx_export_has_ontime_columns_notes_metadata_and_clock_strings() {
|
|||
std::fs::write(&path, export::xlsx(&rundown).unwrap()).unwrap();
|
||||
let tables = reader::read(&path).unwrap();
|
||||
assert_eq!(tables[0].rows[0][0].text, "Time Start");
|
||||
assert_eq!(tables[0].rows[0][7].text, "Time Start (E)");
|
||||
assert_eq!(tables[0].rows[0][16].text, "Time Start (E)");
|
||||
}
|
||||
#[test]
|
||||
fn invalid_or_cancelled_analysis_never_exports() {
|
||||
|
|
|
|||
|
|
@ -297,7 +297,11 @@ operator will start an event on time.
|
|||
Native Ontime JSON is the primary target: it lets the exporter control time
|
||||
relationships and project structure without a second column-mapping step.
|
||||
XLSX export writes one `Ontime` worksheet with `Time Start`, `Time End`, `Duration`, `Cue`,
|
||||
`Title`, `Note` and `Timer Type` columns, followed by selected metadata columns.
|
||||
`Title`, `Note`, `Timer Type`, `Link Start`, `Colour`, `ID`, `Flag`, `Count to end`,
|
||||
`End Action`, `Warning Time`, `Danger Time` and `Skip` columns, followed by selected
|
||||
metadata columns. Playback settings match the JSON export: `Link Start` is explicitly
|
||||
`FALSE` so Ontime does not link events across intentional gaps. Notes contain only
|
||||
columns assigned to Notes; metadata remains in separate columns.
|
||||
These headers match the [official Ontime v4 template](https://docs.google.com/spreadsheets/d/1zT6yRgQUaICEiAFR85VEL-E9hAUDujKg6DaWR0iDYmY/edit).
|
||||
Native JSON uses Ontime's schema keys such as `timeStart`, `timeEnd` and `timerType`.
|
||||
Times use `HH:MM:SS` strings accepted by Ontime. Import the file with Ontime's
|
||||
|
|
|
|||
Loading…
Reference in New Issue