diff options
author | Jamie Murphy <hello@itsjamie.dev> | 2023-02-16 01:59:36 -0800 |
---|---|---|
committer | Jamie Murphy <hello@itsjamie.dev> | 2023-02-16 01:59:36 -0800 |
commit | 0a57aa46c41c1ad16a6f3dc35f45b170643ba8a9 (patch) | |
tree | edd392511670b146ebd610e1f0cfa4eb6011a279 | |
parent | 0ae85592c81b74829bce55c3429f5b0aaa39e79c (diff) | |
download | gnome-todo-0a57aa46c41c1ad16a6f3dc35f45b170643ba8a9.tar.gz |
task: Fix Queryable creation bugs
The property names were misspelled, and the Setter functions for some
Option<> properties didn't accept Option<> inputs
-rw-r--r-- | src/engine/task.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/engine/task.rs b/src/engine/task.rs index 1b25bed3..6a3718ba 100644 --- a/src/engine/task.rs +++ b/src/engine/task.rs @@ -105,22 +105,22 @@ mod imp { self.due_date.get().map(|s| s.to_iso8601()) } - fn set_due_date(&self, value: String) { - self.due_date - .replace(Some(NaiveDateTime::parse_from_iso8601(&value).expect( - "The value needs to be in a format recognizable by ISO8601", - ))); + fn set_due_date(&self, value: Option<String>) { + self.due_date.replace(value.map(|v| { + NaiveDateTime::parse_from_iso8601(&v) + .expect("The value needs to be in a format recognizable by ISO8601") + })); } fn completed(&self) -> Option<String> { self.completed.get().map(|s| s.to_iso8601()) } - fn set_completed(&self, value: String) { - self.completed - .replace(Some(NaiveDateTime::parse_from_iso8601(&value).expect( - "The value needs to be in a format recognizable by ISO8601", - ))); + fn set_completed(&self, value: Option<String>) { + self.completed.replace(value.map(|v| { + NaiveDateTime::parse_from_iso8601(&v) + .expect("The value needs to be in a format recognizable by ISO8601") + })); } fn created(&self) -> String { @@ -186,12 +186,12 @@ impl Task { .property("id", id) .property("title", title) .property("description", description) - .property("due_date", due_date.map(|s| s.to_iso8601())) + .property("due-date", due_date.map(|s| s.to_iso8601())) .property("completed", completed.map(|s| s.to_iso8601())) .property("priority", priority.unwrap_or(9)) .property("created", created.to_iso8601()) - .property("last_modified", last_modified.to_iso8601()) - .property("modification_count", modification_count) + .property("last-modified", last_modified.to_iso8601()) + .property("modification-count", modification_count) .build() } |