Separate gaps from attention filter
This commit is contained in:
parent
2567907223
commit
daf78d2618
|
|
@ -15,6 +15,7 @@ pub(super) enum RowFilter {
|
|||
#[default]
|
||||
Included,
|
||||
Attention,
|
||||
Gaps,
|
||||
}
|
||||
|
||||
pub(super) fn diagnostic_row(d: &Diagnostic) -> Option<usize> {
|
||||
|
|
@ -450,7 +451,8 @@ fn show_row(row: &PreviewRow, filter: RowFilter, table: Option<&Table>, profile:
|
|||
match filter {
|
||||
RowFilter::All => true,
|
||||
RowFilter::Included => !row.automatically_ignored && !ignored_row(row.row, table, profile),
|
||||
RowFilter::Attention => row.gap || !row.issues.is_empty(),
|
||||
RowFilter::Attention => !row.gap && !row.issues.is_empty(),
|
||||
RowFilter::Gaps => row.gap,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1352,6 +1354,7 @@ impl App {
|
|||
ui.selectable_value(&mut self.row_filter, RowFilter::Included, "Included rows")
|
||||
.on_hover_text("Includes events, notes, markers and breaks. Excludes ignored rows and rows containing only ignored columns.");
|
||||
ui.selectable_value(&mut self.row_filter, RowFilter::Attention, "Needs attention");
|
||||
ui.selectable_value(&mut self.row_filter, RowFilter::Gaps, "Gaps");
|
||||
let count = self.analysis.as_ref().map_or(0, |a| a.diagnostics.len());
|
||||
ui.toggle_value(&mut self.show_issue_details, format!("Issues ({count})"));
|
||||
let selection = self.selected_row.is_some() || self.selected_gap.is_some();
|
||||
|
|
@ -1396,9 +1399,13 @@ impl App {
|
|||
.filter(|r| show_row(r, self.row_filter, table, &profile))
|
||||
.collect();
|
||||
if rows.is_empty() {
|
||||
ui.label(if self.row_filter == RowFilter::Attention {
|
||||
"No source rows need attention. Sheet or gap issues, if any, are available under Issues."
|
||||
} else { "No rows match this filter. Choose All rows to review exclusions." });
|
||||
ui.label(match self.row_filter {
|
||||
RowFilter::Attention => {
|
||||
"No source rows need attention. Sheet issues, if any, are available under Issues."
|
||||
}
|
||||
RowFilter::Gaps => "No gaps were detected in this schedule.",
|
||||
_ => "No rows match this filter. Choose All rows to review exclusions.",
|
||||
});
|
||||
}
|
||||
let compact = ui.available_width() < 760.0;
|
||||
let title_width = if compact {
|
||||
|
|
@ -1824,12 +1831,18 @@ mod tests {
|
|||
assert_eq!(rows[gap + 1].row, 15);
|
||||
assert_eq!(rows[gap].start, display(9 * 3_600_000 + 5 * 60_000));
|
||||
assert_eq!(rows[gap].duration, display(10 * 60_000));
|
||||
assert!(show_row(
|
||||
assert!(!show_row(
|
||||
&rows[gap],
|
||||
RowFilter::Attention,
|
||||
Some(&app.tables[0]),
|
||||
&Profile::default()
|
||||
));
|
||||
assert!(show_row(
|
||||
&rows[gap],
|
||||
RowFilter::Gaps,
|
||||
Some(&app.tables[0]),
|
||||
&Profile::default()
|
||||
));
|
||||
assert_eq!(analysis.rundown.as_ref().unwrap().entries.len(), 2);
|
||||
let profile = Profile {
|
||||
row_kinds: [(3, "gap".into())].into_iter().collect(),
|
||||
|
|
@ -2914,6 +2927,7 @@ mod tests {
|
|||
assert!(numbers(RowFilter::Included).contains(&4));
|
||||
assert!(!numbers(RowFilter::Attention).contains(&4));
|
||||
assert!(numbers(RowFilter::Attention).contains(&5));
|
||||
assert!(numbers(RowFilter::Gaps).is_empty());
|
||||
assert_eq!(
|
||||
rows.iter().find(|r| r.row == 4).unwrap().kind,
|
||||
"Note for row 2"
|
||||
|
|
|
|||
Loading…
Reference in New Issue