mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
add 'entry' key to tasks when created
This commit is contained in:
parent
d6efad06ee
commit
9824ac1fd3
3 changed files with 15 additions and 1 deletions
|
@ -108,6 +108,7 @@ impl Replica {
|
|||
let mut task = Task::new(uuid, taskmap).into_mut(self);
|
||||
task.set_description(description)?;
|
||||
task.set_status(status)?;
|
||||
task.set_entry(Utc::now())?;
|
||||
Ok(task.into_immut())
|
||||
}
|
||||
|
||||
|
@ -228,7 +229,7 @@ mod tests {
|
|||
..
|
||||
} = op
|
||||
{
|
||||
if property == "modified" {
|
||||
if property == "modified" || property == "entry" {
|
||||
if value.is_some() {
|
||||
value = Some("just-now".into());
|
||||
}
|
||||
|
@ -277,6 +278,13 @@ mod tests {
|
|||
value: Some("pending".into()),
|
||||
timestamp: now,
|
||||
},
|
||||
ReplicaOp::Update {
|
||||
uuid: t.get_uuid(),
|
||||
property: "entry".into(),
|
||||
old_value: None,
|
||||
value: Some("just-now".into()),
|
||||
timestamp: now,
|
||||
},
|
||||
ReplicaOp::Update {
|
||||
uuid: t.get_uuid(),
|
||||
property: "modified".into(),
|
||||
|
|
|
@ -57,6 +57,7 @@ enum Prop {
|
|||
Start,
|
||||
Status,
|
||||
Wait,
|
||||
Entry,
|
||||
}
|
||||
|
||||
#[allow(clippy::ptr_arg)]
|
||||
|
@ -277,6 +278,10 @@ impl<'r> TaskMut<'r> {
|
|||
self.set_string(Prop::Description.as_ref(), Some(description))
|
||||
}
|
||||
|
||||
pub(crate) fn set_entry(&mut self, entry: DateTime<Utc>) -> anyhow::Result<()> {
|
||||
self.set_timestamp(Prop::Entry.as_ref(), Some(entry))
|
||||
}
|
||||
|
||||
pub fn set_wait(&mut self, wait: Option<DateTime<Utc>>) -> anyhow::Result<()> {
|
||||
self.set_timestamp(Prop::Wait.as_ref(), wait)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue