diff --git a/pttodoer/src/main.rs b/pttodoer/src/main.rs index 3855a8b..89399b2 100644 --- a/pttodoer/src/main.rs +++ b/pttodoer/src/main.rs @@ -96,7 +96,7 @@ impl Task { } pub fn is_done(&self) -> bool { - self.0.len() == 1 && self.get_value("done".to_string()).is_some() + self.get_value("_done".to_string()).is_some() } pub fn is_due(&self) -> bool { @@ -192,11 +192,11 @@ mod test_task { #[test] fn is_done() { let mut t = Task::new(); - t.set("done".to_string(), "anything".to_string()); + t.set("_done".to_string(), "anything".to_string()); eprintln!("{:?}", t.0); assert!(t.is_done()); - t.set_value("done".to_string(), serde_yaml::Value::Null); + t.set_value("_done".to_string(), serde_yaml::Value::Null); eprintln!("{:?}", t.0); assert!(t.is_done()); } diff --git a/pttodoer/src/testdata/tasks_due_scheduled_done.yaml b/pttodoer/src/testdata/tasks_due_scheduled_done.yaml index 8279173..3654126 100644 --- a/pttodoer/src/testdata/tasks_due_scheduled_done.yaml +++ b/pttodoer/src/testdata/tasks_due_scheduled_done.yaml @@ -5,6 +5,6 @@ - 3do: repeating scheduled schedule: 0 0 1 1 * ts: 2001-02-03T04:05:06Z -- done: +- _done: do: done schedule: 2006-04-05