Collect start date and reminder state
Already fetch the start date and reminder state for issues immediately and have them available in the struct Task.
This commit is contained in:
parent
7dc6eb305d
commit
64d28bb868
7 changed files with 148 additions and 43 deletions
28
src/task.rs
28
src/task.rs
|
|
@ -15,22 +15,28 @@ pub struct Task {
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum State {
|
||||
/// The task is open and pending completion.
|
||||
///
|
||||
/// An optional due date may be present.
|
||||
Open { due: Option<jiff::Zoned> },
|
||||
/// The task is open but has no due date.
|
||||
Open,
|
||||
|
||||
/// The task is scheduled and waiting for completion.
|
||||
Scheduled(ScheduledInfo),
|
||||
|
||||
/// The task has been completed at the specified time.
|
||||
Completed { date: jiff::Zoned },
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub fn due_date_if_open(&self) -> Option<&jiff::Zoned> {
|
||||
match self {
|
||||
State::Open { due } => due.as_ref(),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ScheduledInfo {
|
||||
pub due_date: jiff::Zoned,
|
||||
pub start_date: jiff::Zoned,
|
||||
pub reminded: ReminderState,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ReminderState {
|
||||
NotReminded,
|
||||
Reminded { date: jiff::Zoned },
|
||||
RemindedUrgently { date: jiff::Zoned },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue