mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Merge branch 'main' into issue327
This commit is contained in:
commit
a49e51defd
3 changed files with 17 additions and 1 deletions
|
@ -40,6 +40,7 @@ The following keys, and key formats, are defined:
|
|||
* `end` - if present, the time at which this task was completed or deleted (note that this key may not agree with `status`: it may be present for a pending task, or absent for a deleted or completed task)
|
||||
* `tag_<tag>` - indicates this task has tag `<tag>` (value is an empty string)
|
||||
* `wait` - indicates the time before which this task should be hidden, as it is not actionable
|
||||
* `entry` - the time at which the task was created
|
||||
* `annotation_<timestamp>` - value is an annotation created at the given time
|
||||
|
||||
The following are not yet implemented:
|
||||
|
|
|
@ -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,9 @@ mod tests {
|
|||
..
|
||||
} = op
|
||||
{
|
||||
if property == "modified" || property == "end" {
|
||||
// rewrite automatically-created dates to "just-now" for ease
|
||||
// of testing
|
||||
if property == "modified" || property == "end" || property == "entry" {
|
||||
if value.is_some() {
|
||||
value = Some("just-now".into());
|
||||
}
|
||||
|
@ -277,6 +280,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(),
|
||||
|
|
|
@ -58,6 +58,7 @@ enum Prop {
|
|||
Status,
|
||||
Wait,
|
||||
End,
|
||||
Entry,
|
||||
}
|
||||
|
||||
#[allow(clippy::ptr_arg)]
|
||||
|
@ -292,6 +293,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