Allow correcting all rundown timing fields
This commit is contained in:
parent
b25eb0a481
commit
f26715b1ad
|
|
@ -170,14 +170,23 @@ fn infer_inner(
|
|||
profile_errors.push(Diagnostic::new(1,"INVALID_ROW_OVERRIDE",&table.name,format!("Invalid row/kind {row}: {kind}; use an existing data row and event, gap, marker, note or ignore")));
|
||||
}
|
||||
}
|
||||
for &row in profile.durations.keys() {
|
||||
if row <= header + 1 || row > table.rows.len() {
|
||||
profile_errors.push(Diagnostic::new(
|
||||
1,
|
||||
"INVALID_DURATION_OVERRIDE",
|
||||
&table.name,
|
||||
format!("Duration override row {row} is outside data rows"),
|
||||
));
|
||||
for (role, values) in [
|
||||
("START", &profile.starts),
|
||||
("END", &profile.ends),
|
||||
("DURATION", &profile.durations),
|
||||
] {
|
||||
for &row in values.keys() {
|
||||
if row <= header + 1 || row > table.rows.len() {
|
||||
profile_errors.push(Diagnostic::new(
|
||||
1,
|
||||
&format!("INVALID_{role}_OVERRIDE"),
|
||||
&table.name,
|
||||
format!(
|
||||
"{} override row {row} is outside data rows",
|
||||
role.to_lowercase()
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (col, expected) in &profile.expected_headers {
|
||||
|
|
@ -386,6 +395,11 @@ fn infer_inner(
|
|||
let Some(d) = duration(cell, Some(u)) else {
|
||||
return false;
|
||||
};
|
||||
if profile.starts.contains_key(&(*r + 1))
|
||||
|| profile.ends.contains_key(&(*r + 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
let Some((a, b)) = clock_range(&table.cell(*r, start)) else {
|
||||
return true;
|
||||
};
|
||||
|
|
@ -415,7 +429,13 @@ fn infer_inner(
|
|||
continue;
|
||||
}
|
||||
let cell = table.cell(row, col);
|
||||
if r == "duration" && profile.durations.contains_key(&(row + 1)) {
|
||||
let overridden = match r {
|
||||
"start" => profile.starts.contains_key(&(row + 1)),
|
||||
"end" => profile.ends.contains_key(&(row + 1)),
|
||||
"duration" => profile.durations.contains_key(&(row + 1)),
|
||||
_ => false,
|
||||
};
|
||||
if overridden {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ impl App {
|
|||
self.decisions_changed();
|
||||
}
|
||||
}
|
||||
ui.label("Optional JSON profile: columns (start/end/duration/title), column_usage (metadata/ignore), duration_unit, row_kinds, durations, untimed_as_notes, ignore_warnings. Column letters and source rows are shown in diagnostics.");
|
||||
ui.label("Optional JSON profile: columns (start/end/duration/title), column_usage (metadata/ignore), duration_unit, row_kinds, starts, ends, durations, untimed_as_notes, ignore_warnings. Column letters and source rows are shown in diagnostics.");
|
||||
if ui
|
||||
.add(
|
||||
egui::TextEdit::multiline(&mut self.profile)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ fn diagnostic_resolution(row: &PreviewRow, index: usize, diagnostic: &Diagnostic
|
|||
"Correct the start, end or duration so the resulting duration is positive, then apply and recheck."
|
||||
}
|
||||
"CONFLICTING_TIMES" | "CONFLICTING_MERGE" => {
|
||||
"Correct the source timing or enter an explicit duration in Edit row, then apply and recheck."
|
||||
"Correct the source timing or edit the start, end or duration in Edit row, then apply and recheck."
|
||||
}
|
||||
"UNTIMED_ROW" => {
|
||||
"Open Details and choose Note, Marker, Gap or Ignore, or enter a duration for an event; then apply and recheck."
|
||||
|
|
@ -466,6 +466,8 @@ fn ignorable_rows(a: &Analysis, table: Option<&Table>, profile: &Profile) -> Vec
|
|||
.all(|i| needs_information(&a.diagnostics[*i]))
|
||||
&& !ignored_row(r.row, table, profile)
|
||||
&& !profile.row_kinds.contains_key(&r.row)
|
||||
&& !profile.starts.contains_key(&r.row)
|
||||
&& !profile.ends.contains_key(&r.row)
|
||||
&& !profile.durations.contains_key(&r.row)
|
||||
})
|
||||
.map(|r| r.row)
|
||||
|
|
@ -727,6 +729,55 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
fn timing_override_control(
|
||||
ui: &mut egui::Ui,
|
||||
values: &mut std::collections::BTreeMap<usize, String>,
|
||||
row: usize,
|
||||
role: &str,
|
||||
hint: &str,
|
||||
clock_value: bool,
|
||||
) {
|
||||
let mut value = values.get(&row).cloned().unwrap_or_default();
|
||||
ui.vertical(|ui| {
|
||||
ui.label(role);
|
||||
if ui
|
||||
.add(
|
||||
egui::TextEdit::singleline(&mut value)
|
||||
.id_salt(("timing_override", role, row))
|
||||
.hint_text(hint)
|
||||
.desired_width(145.0),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
if value.trim().is_empty() {
|
||||
values.remove(&row);
|
||||
} else {
|
||||
values.insert(row, value.clone());
|
||||
}
|
||||
}
|
||||
let parsed = crate::model::Cell {
|
||||
text: value.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
let valid = value.trim().is_empty()
|
||||
|| if clock_value {
|
||||
crate::time::clock(&parsed).is_some()
|
||||
} else {
|
||||
crate::time::duration(&parsed, Some("hh:mm")).is_some()
|
||||
};
|
||||
if !valid {
|
||||
ui.colored_label(
|
||||
PREVIEW_RED,
|
||||
if clock_value {
|
||||
"Use a clock time"
|
||||
} else {
|
||||
"Use an explicit duration"
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn gap_resolution_control(ui: &mut egui::Ui, profile: &mut Profile, key: &str) {
|
||||
let mut action = profile
|
||||
.gap_resolutions
|
||||
|
|
@ -797,8 +848,8 @@ impl App {
|
|||
egui::Window::new(format!("Row {row} · {}", self.sheet))
|
||||
.id(egui::Id::new("row_details"))
|
||||
.open(&mut open)
|
||||
.default_width(560.0)
|
||||
.default_height(500.0)
|
||||
.default_width(620.0)
|
||||
.default_height(560.0)
|
||||
.vscroll(true)
|
||||
.show(ctx, |ui| {
|
||||
if let Some(preview) = &preview {
|
||||
|
|
@ -830,14 +881,34 @@ impl App {
|
|||
Self::row_kind_control(ui, &mut profile, row, if self.dirty { None } else { detected });
|
||||
});
|
||||
if !preview.gap {
|
||||
ui.label("Duration correction");
|
||||
let mut duration = profile.durations.get(&row).cloned().unwrap_or_default();
|
||||
if ui.add(egui::TextEdit::singleline(&mut duration)
|
||||
.id_salt(("editor_duration", row)).hint_text("e.g. 2 min").desired_width(180.0)).changed() {
|
||||
if duration.trim().is_empty() { profile.durations.remove(&row); }
|
||||
else { profile.durations.insert(row, duration); }
|
||||
}
|
||||
ui.small("Leave empty to use the source duration. Close this window and apply & recheck after editing.");
|
||||
ui.label("Timing corrections");
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
Self::timing_override_control(
|
||||
ui,
|
||||
&mut profile.starts,
|
||||
row,
|
||||
"Start",
|
||||
"e.g. 09:00",
|
||||
true,
|
||||
);
|
||||
Self::timing_override_control(
|
||||
ui,
|
||||
&mut profile.ends,
|
||||
row,
|
||||
"End",
|
||||
"e.g. 09:30",
|
||||
true,
|
||||
);
|
||||
Self::timing_override_control(
|
||||
ui,
|
||||
&mut profile.durations,
|
||||
row,
|
||||
"Duration",
|
||||
"e.g. 2 min",
|
||||
false,
|
||||
);
|
||||
});
|
||||
ui.small("Leave a field empty to use or calculate it from the source values. Close this window and apply & recheck after editing.");
|
||||
}
|
||||
if let Some(a) = &self.analysis {
|
||||
if !preview.issues.is_empty() { ui.heading("Needs attention"); }
|
||||
|
|
@ -2125,6 +2196,8 @@ mod tests {
|
|||
row_kinds: [(5, "ignore".into()), (6, "note".into())]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
starts: [(7, "09:30".into())].into_iter().collect(),
|
||||
ends: [(7, "09:32".into())].into_iter().collect(),
|
||||
durations: [(7, "2 min".into())].into_iter().collect(),
|
||||
..Default::default()
|
||||
};
|
||||
|
|
@ -2144,6 +2217,8 @@ mod tests {
|
|||
let profile: Profile = serde_json::from_str(&app.profile).unwrap();
|
||||
assert_eq!(profile.row_kinds.len(), 10);
|
||||
assert_eq!(profile.row_kinds[&6], "note");
|
||||
assert_eq!(profile.starts[&7], "09:30");
|
||||
assert_eq!(profile.ends[&7], "09:32");
|
||||
assert_eq!(profile.durations[&7], "2 min");
|
||||
assert_eq!(profile.row_kinds[&3], "ignore");
|
||||
assert!(!profile.row_kinds.contains_key(&2));
|
||||
|
|
@ -2224,7 +2299,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn whole_row_selection_and_editor_duration_changes() {
|
||||
fn whole_row_selection_and_editor_timing_changes() {
|
||||
let mut app = sample();
|
||||
app.selected_row = None;
|
||||
let ctx = egui::Context::default();
|
||||
|
|
@ -2232,6 +2307,7 @@ mod tests {
|
|||
let size = [860.0, 900.0];
|
||||
render(&mut app, &ctx, size, vec![]);
|
||||
let labels = render(&mut app, &ctx, size, vec![]);
|
||||
assert!(!labels.iter().any(|(s, _)| s == "e.g. 09:00"));
|
||||
assert!(!labels.iter().any(|(s, _)| s == "e.g. 2 min"));
|
||||
let title = labels.iter().find(|(s, _)| s == "Opening").unwrap().1;
|
||||
let blank = egui::pos2(title.right() + 80.0, title.center().y);
|
||||
|
|
@ -2242,6 +2318,34 @@ mod tests {
|
|||
assert!(app.row_details);
|
||||
render(&mut app, &ctx, size, vec![]);
|
||||
let labels = render(&mut app, &ctx, size, vec![]);
|
||||
let start = labels
|
||||
.iter()
|
||||
.find(|(s, _)| s == "e.g. 09:00")
|
||||
.unwrap()
|
||||
.1
|
||||
.center();
|
||||
click_size(&mut app, &ctx, start, size);
|
||||
render(
|
||||
&mut app,
|
||||
&ctx,
|
||||
size,
|
||||
vec![egui::Event::Text("08:55".into())],
|
||||
);
|
||||
let labels = render(&mut app, &ctx, size, vec![]);
|
||||
let end = labels
|
||||
.iter()
|
||||
.find(|(s, _)| s == "e.g. 09:30")
|
||||
.unwrap()
|
||||
.1
|
||||
.center();
|
||||
click_size(&mut app, &ctx, end, size);
|
||||
render(
|
||||
&mut app,
|
||||
&ctx,
|
||||
size,
|
||||
vec![egui::Event::Text("09:00".into())],
|
||||
);
|
||||
let labels = render(&mut app, &ctx, size, vec![]);
|
||||
let duration = labels
|
||||
.iter()
|
||||
.find(|(s, _)| s == "e.g. 2 min")
|
||||
|
|
@ -2256,6 +2360,8 @@ mod tests {
|
|||
vec![egui::Event::Text("2 min".into())],
|
||||
);
|
||||
let profile: Profile = serde_json::from_str(&app.profile).unwrap();
|
||||
assert_eq!(profile.starts[&2], "08:55");
|
||||
assert_eq!(profile.ends[&2], "09:00");
|
||||
assert_eq!(profile.durations[&2], "2 min");
|
||||
assert!(app.dirty);
|
||||
app.row_details = false;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ struct Args {
|
|||
/// Required for workbooks with multiple sheets; exact name.
|
||||
#[arg(long)]
|
||||
sheet: Option<String>,
|
||||
/// JSON profile: explicit columns, units, row classifications and duration corrections.
|
||||
/// JSON profile: explicit columns, units, row classifications and timing corrections.
|
||||
#[arg(long)]
|
||||
profile: Option<PathBuf>,
|
||||
#[arg(short, long)]
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ pub struct Profile {
|
|||
pub ignore_warnings: bool,
|
||||
/// One-based source row -> event, gap, marker, note, or ignore.
|
||||
pub row_kinds: BTreeMap<usize, String>,
|
||||
/// Explicit start clock overrides (e.g. 09:30 or 09:30:00).
|
||||
pub starts: BTreeMap<usize, String>,
|
||||
/// Explicit end clock overrides (e.g. 10:15 or 10:15:00).
|
||||
pub ends: BTreeMap<usize, String>,
|
||||
/// Explicit duration overrides, expressed with units (e.g. 2 min).
|
||||
pub durations: BTreeMap<usize, String>,
|
||||
/// Exact gap key -> keep, extend_previous, or add_to_next.
|
||||
|
|
|
|||
|
|
@ -50,12 +50,27 @@ fn supplied_duration(table: &Table, row: usize, map: &Mapping, profile: &Profile
|
|||
.and_then(|c| duration(&table.cell(row, c), map.duration_unit.as_deref()))
|
||||
}
|
||||
}
|
||||
fn times(table: &Table, row: usize, map: &Mapping) -> (Option<i64>, Option<i64>) {
|
||||
fn override_clock(values: &std::collections::BTreeMap<usize, String>, row: usize) -> Option<i64> {
|
||||
values.get(&(row + 1)).and_then(|text| {
|
||||
clock(&Cell {
|
||||
text: text.clone(),
|
||||
..Cell::default()
|
||||
})
|
||||
})
|
||||
}
|
||||
fn times(
|
||||
table: &Table,
|
||||
row: usize,
|
||||
map: &Mapping,
|
||||
profile: &Profile,
|
||||
) -> (Option<i64>, Option<i64>) {
|
||||
let pair = clock_range(&table.cell(row, map.start));
|
||||
(
|
||||
pair.map(|p| p.0),
|
||||
pair.and_then(|p| p.1)
|
||||
.or_else(|| map.end.and_then(|c| clock(&table.cell(row, c)))),
|
||||
override_clock(&profile.starts, row).or_else(|| pair.map(|p| p.0)),
|
||||
override_clock(&profile.ends, row).or_else(|| {
|
||||
pair.and_then(|p| p.1)
|
||||
.or_else(|| map.end.and_then(|c| clock(&table.cell(row, c))))
|
||||
}),
|
||||
)
|
||||
}
|
||||
/// Stage 2 records untimed break boundaries before any unknown duration is filled.
|
||||
|
|
@ -96,7 +111,7 @@ pub fn identify_gaps(table: &Table, map: &Mapping, profile: &Profile) -> Vec<Gap
|
|||
{
|
||||
return None;
|
||||
}
|
||||
let (start, end) = times(table, r, map);
|
||||
let (start, end) = times(table, r, map, profile);
|
||||
let end = end.or_else(|| {
|
||||
start
|
||||
.zip(supplied_duration(table, r, map, profile))
|
||||
|
|
@ -122,13 +137,13 @@ pub fn identify_gaps(table: &Table, map: &Mapping, profile: &Profile) -> Vec<Gap
|
|||
}) {
|
||||
continue;
|
||||
}
|
||||
let (start, end) = times(table, a, map);
|
||||
let (start, end) = times(table, a, map, profile);
|
||||
let end = end.or_else(|| {
|
||||
start
|
||||
.zip(supplied_duration(table, a, map, profile))
|
||||
.map(|(s, d)| s + d)
|
||||
});
|
||||
if let (Some(end), Some(next)) = (end, times(table, b, map).0)
|
||||
if let (Some(end), Some(next)) = (end, times(table, b, map, profile).0)
|
||||
&& next > end
|
||||
{
|
||||
gaps.push(Gap {
|
||||
|
|
@ -236,6 +251,24 @@ pub fn construct(
|
|||
.push(format!("Row {} explicitly excluded by profile", r + 1));
|
||||
continue;
|
||||
}
|
||||
if profile.starts.contains_key(&(r + 1)) && override_clock(&profile.starts, r).is_none() {
|
||||
errors.push(Diagnostic::new(
|
||||
3,
|
||||
"INVALID_START_OVERRIDE",
|
||||
at(table, r),
|
||||
"Start correction must be a clock time such as 09:30 or 09:30:00",
|
||||
));
|
||||
continue;
|
||||
}
|
||||
if profile.ends.contains_key(&(r + 1)) && override_clock(&profile.ends, r).is_none() {
|
||||
errors.push(Diagnostic::new(
|
||||
3,
|
||||
"INVALID_END_OVERRIDE",
|
||||
at(table, r),
|
||||
"End correction must be a clock time such as 10:15 or 10:15:00",
|
||||
));
|
||||
continue;
|
||||
}
|
||||
if let Some(gap) = gaps
|
||||
.iter_mut()
|
||||
.find(|g| g.source_rows.iter().any(|s| s.row == r + 1))
|
||||
|
|
@ -244,7 +277,8 @@ pub fn construct(
|
|||
gap.start_ms = cursor;
|
||||
}
|
||||
if gap.end_ms.is_none() {
|
||||
gap.end_ms = (r + 1..table.rows.len()).find_map(|next| times(table, next, &map).0);
|
||||
gap.end_ms =
|
||||
(r + 1..table.rows.len()).find_map(|next| times(table, next, &map, profile).0);
|
||||
}
|
||||
cursor = gap.end_ms;
|
||||
if gap.start_ms.is_none() || gap.end_ms.is_none() {
|
||||
|
|
@ -252,12 +286,12 @@ pub fn construct(
|
|||
}
|
||||
continue;
|
||||
}
|
||||
let (given_start, given_end) = times(table, r, &map);
|
||||
let (given_start, given_end) = times(table, r, &map, profile);
|
||||
let d = supplied_duration(table, r, &map, profile);
|
||||
if profile.durations.contains_key(&(r + 1)) && d.is_none() {
|
||||
errors.push(Diagnostic::new(
|
||||
3,
|
||||
"INVALID_OVERRIDE",
|
||||
"INVALID_DURATION_OVERRIDE",
|
||||
at(table, r),
|
||||
"Duration override needs an explicit unit, e.g. 2 min",
|
||||
));
|
||||
|
|
@ -381,6 +415,10 @@ pub fn construct(
|
|||
e.decisions
|
||||
.push("Start derived from preceding event or merged block".into());
|
||||
}
|
||||
if profile.starts.contains_key(&(r + 1)) {
|
||||
e.decisions
|
||||
.push("Start explicitly overridden by profile; original cells retained".into());
|
||||
}
|
||||
if d.is_none() {
|
||||
e.decisions
|
||||
.push("Duration derived from explicit start/end".into());
|
||||
|
|
@ -389,13 +427,17 @@ pub fn construct(
|
|||
e.decisions
|
||||
.push("End derived from start and duration".into());
|
||||
}
|
||||
if profile.ends.contains_key(&(r + 1)) {
|
||||
e.decisions
|
||||
.push("End explicitly overridden by profile; original cells retained".into());
|
||||
}
|
||||
if profile.durations.contains_key(&(r + 1)) {
|
||||
e.decisions
|
||||
.push("Duration explicitly overridden by profile; original cells retained".into());
|
||||
}
|
||||
if merge_end > r && !child_group {
|
||||
for continuation in r + 1..=merge_end.min(table.rows.len() - 1) {
|
||||
if times(table, continuation, &map).0.is_some()
|
||||
if times(table, continuation, &map, profile).0.is_some()
|
||||
|| supplied_duration(table, continuation, &map, profile).is_some()
|
||||
{
|
||||
errors.push(Diagnostic::new(3,"CONFLICTING_MERGE",at(table,continuation),"A shared merged timer contains another timed row; clarify the block boundaries"));
|
||||
|
|
@ -580,7 +622,7 @@ pub fn validate(r: &Rundown) -> Vec<Diagnostic> {
|
|||
if (e.end_ms - e.start_ms - e.duration_ms).abs() > 1 {
|
||||
add(
|
||||
"CONFLICTING_TIMES",
|
||||
"Start, end and duration disagree; correct the source or apply an explicit duration override",
|
||||
"Start, end and duration disagree; correct the source or apply explicit timing overrides",
|
||||
);
|
||||
}
|
||||
if !(0..86_400_000).contains(&e.start_ms)
|
||||
|
|
@ -691,6 +733,8 @@ pub fn analyze(
|
|||
*row > 0
|
||||
&& *row <= table.rows.len()
|
||||
&& !effective.row_kinds.contains_key(row)
|
||||
&& !profile.starts.contains_key(row)
|
||||
&& !profile.ends.contains_key(row)
|
||||
&& !profile.durations.contains_key(row)
|
||||
&& !analysis
|
||||
.diagnostics
|
||||
|
|
|
|||
|
|
@ -66,9 +66,14 @@ mod tests {
|
|||
};
|
||||
let path = remembered_path(dir.path(), &table).unwrap();
|
||||
let mut profile = Profile::default();
|
||||
profile.starts.insert(2, "09:00".into());
|
||||
profile.ends.insert(2, "09:02".into());
|
||||
profile.durations.insert(2, "2 min".into());
|
||||
save(&profile, &path, &source, false).unwrap();
|
||||
assert_eq!(load(&path).unwrap().durations[&2], "2 min");
|
||||
let loaded = load(&path).unwrap();
|
||||
assert_eq!(loaded.starts[&2], "09:00");
|
||||
assert_eq!(loaded.ends[&2], "09:02");
|
||||
assert_eq!(loaded.durations[&2], "2 min");
|
||||
assert!(save(&profile, &path, &source, false).is_err());
|
||||
save(&profile, &path, &source, true).unwrap();
|
||||
assert!(save(&profile, &source, &source, true).is_err());
|
||||
|
|
|
|||
|
|
@ -292,16 +292,76 @@ fn notes_and_markers_require_explicit_choices() {
|
|||
}
|
||||
#[test]
|
||||
fn explicit_corrections_preserve_originals() {
|
||||
let t = table(&[&["Start", "Duration", "Title"], &["09:00", "TBC", "A"]]);
|
||||
let t = table(&[
|
||||
&["Start", "End", "Duration", "Title"],
|
||||
&["09:00", "10:00", "TBC", "A"],
|
||||
]);
|
||||
let p = Profile {
|
||||
starts: BTreeMap::from([(2, "09:15".into())]),
|
||||
ends: BTreeMap::from([(2, "09:20".into())]),
|
||||
durations: BTreeMap::from([(2, "5 min".into())]),
|
||||
..Profile::default()
|
||||
};
|
||||
let a = analyze(&t, &p);
|
||||
assert!(a.diagnostics.is_empty());
|
||||
assert!(a.diagnostics.is_empty(), "{:?}", a.diagnostics);
|
||||
let r = a.rundown.unwrap();
|
||||
assert_eq!(r.entries[0].start_ms, 33_300_000);
|
||||
assert_eq!(r.entries[0].end_ms, 33_600_000);
|
||||
assert_eq!(r.entries[0].duration_ms, 300_000);
|
||||
assert_eq!(r.entries[0].source_rows[0].cells["B"].text, "TBC");
|
||||
assert_eq!(r.entries[0].source_rows[0].cells["A"].text, "09:00");
|
||||
assert_eq!(r.entries[0].source_rows[0].cells["B"].text, "10:00");
|
||||
assert_eq!(r.entries[0].source_rows[0].cells["C"].text, "TBC");
|
||||
|
||||
for (profile, code) in [
|
||||
(
|
||||
Profile {
|
||||
starts: BTreeMap::from([(2, "morning".into())]),
|
||||
durations: BTreeMap::from([(2, "5 min".into())]),
|
||||
..Profile::default()
|
||||
},
|
||||
"INVALID_START_OVERRIDE",
|
||||
),
|
||||
(
|
||||
Profile {
|
||||
ends: BTreeMap::from([(2, "later".into())]),
|
||||
durations: BTreeMap::from([(2, "5 min".into())]),
|
||||
..Profile::default()
|
||||
},
|
||||
"INVALID_END_OVERRIDE",
|
||||
),
|
||||
] {
|
||||
assert!(
|
||||
analyze(&t, &profile)
|
||||
.diagnostics
|
||||
.iter()
|
||||
.any(|d| d.code == code)
|
||||
);
|
||||
}
|
||||
|
||||
let overlap = table(&[
|
||||
&["Start", "Duration", "Title"],
|
||||
&["09:00", "1 h", "Opening"],
|
||||
&["09:30", "30 min", "Next"],
|
||||
]);
|
||||
assert!(
|
||||
analyze(&overlap, &Profile::default())
|
||||
.diagnostics
|
||||
.iter()
|
||||
.any(|d| d.code == "OVERLAP")
|
||||
);
|
||||
let corrected = analyze(
|
||||
&overlap,
|
||||
&Profile {
|
||||
starts: BTreeMap::from([(3, "10:00".into())]),
|
||||
..Profile::default()
|
||||
},
|
||||
);
|
||||
assert!(
|
||||
corrected.diagnostics.is_empty(),
|
||||
"{:?}",
|
||||
corrected.diagnostics
|
||||
);
|
||||
assert_eq!(corrected.rundown.unwrap().entries[1].start_ms, 36_000_000);
|
||||
}
|
||||
#[test]
|
||||
fn atomic_publication_preserves_source_and_existing_output() {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ errors must remain visible with direct corrective actions.
|
|||
- [x] Add initial Setup/Review/Results GUI, source preview, column/unit selectors,
|
||||
shared profile controls and worker/cancellation tests.
|
||||
- [x] Keep inference evidence and the source table on Review after failures;
|
||||
add column-role dropdowns, row classifications and duration corrections.
|
||||
add column-role dropdowns, row classifications and start/end/duration corrections.
|
||||
- [x] Save/overwrite/save-as portable resolution profiles and explicitly remember,
|
||||
reuse or forget validated resolutions matched to the complete sheet.
|
||||
- [x] Redesign Review into Resolve rows / Schedule preview / Columns, with one
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ visually distinct from labels and ordinary actions; the active tab uses the stro
|
|||
table. Start/end/duration, titles, colored issues and row types are visible
|
||||
together. Click anywhere on a source row or inferred gap to select it; a subtle tint marks
|
||||
the selection while retaining its status color. **Edit row…** opens the selected source
|
||||
row editor, including duration correction. **Edit gap…** opens an inferred gap's timing,
|
||||
row editor, including start, end and duration corrections. **Edit gap…** opens an inferred gap's timing,
|
||||
diagnostics and allocation choice even though it has no source cells. **All rows** includes ignored rows;
|
||||
**Included rows** hides ignored rows and rows containing only ignored columns,
|
||||
while keeping notes, markers and breaks; **Needs attention** shows rows with
|
||||
|
|
@ -99,7 +99,7 @@ visually distinct from labels and ordinary actions; the active tab uses the stro
|
|||
**Details** to open the row editor. Ignoring requires recheck and can be undone
|
||||
under All rows. **Ignore all unresolved (N)** applies this to unresolved source
|
||||
rows across the sheet, regardless of the current filter. Timed rows, timing
|
||||
errors and existing manual row/duration corrections are excluded.
|
||||
errors and existing manual row/timing corrections are excluded.
|
||||
Hover over a title or details button for row status and full diagnostic explanations.
|
||||
Double-click anywhere on a source row, or click its **Details** / **Error** button,
|
||||
to open the same editor (inline dropdowns keep their normal interaction).
|
||||
|
|
@ -129,9 +129,10 @@ The row type selector shows the detected type in parentheses, such as **Auto (Ev
|
|||
Click **Apply & recheck** after corrections. Pending edits retain the issue list
|
||||
and previous preview so you can resolve several rows without losing your place;
|
||||
export and remembering a resolution remain blocked until validation succeeds.
|
||||
Blank duration corrections restore source values. Missing durations and untimed
|
||||
row decisions can be resolved here. Unsupported interpretations, invalid
|
||||
start/end values, conflicting timings and unresolved overlaps retain explicit
|
||||
Blank timing corrections restore source or calculated values. Start and end accept
|
||||
clock times such as `09:30` or `09:30:00`; duration accepts explicit values such as
|
||||
`2 min` or `00:02:00`. Missing timings, overlaps and untimed row decisions can be
|
||||
resolved here. Unsupported interpretations and unresolved conflicts retain explicit
|
||||
errors; correct the source when available controls cannot express the intended fix.
|
||||
CLI untimed-row errors also include a labeled source preview.
|
||||
|
||||
|
|
@ -245,6 +246,8 @@ Pass `--profile mapping.json`, or load/edit the same JSON in the desktop app:
|
|||
"expected_headers": {"A": "Heure", "B": "Durée"},
|
||||
"untimed_as_notes": true,
|
||||
"row_kinds": {"20": "marker"},
|
||||
"starts": {"8": "09:30"},
|
||||
"ends": {"8": "09:32"},
|
||||
"durations": {"8": "2 min"}
|
||||
}
|
||||
```
|
||||
|
|
@ -255,7 +258,9 @@ roles are `start`, `end`, `duration` and `title`. `duration_unit` accepts `minut
|
|||
`seconds`, `hh:mm`, `mm:ss` or `excel`. Cell number formats establish Excel time
|
||||
units where available; otherwise units must be explicit or consistently supported
|
||||
by independent start/end pairs. Unknown profile keys and changed expected headers
|
||||
are errors. Explicit mappings still undergo whole-column validation.
|
||||
are errors. `starts`, `ends` and `durations` are keyed by one-based source row;
|
||||
corrected cells are excluded from whole-column validation while all remaining
|
||||
explicit mappings still undergo it.
|
||||
|
||||
`column_usage` maps column letters to `metadata` or `ignore`. Both choices prevent
|
||||
that column from being inferred as a start, end, duration or title, even when its
|
||||
|
|
|
|||
Loading…
Reference in New Issue