Fix: Provide header flag for timetracking entries
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
8852a2b3ba
commit
f4fa8b71dd
4 changed files with 18 additions and 3 deletions
|
@ -32,3 +32,4 @@ libimagerror = { version = "0.10.0", path = "../../../lib/core/libimager
|
|||
libimagstore = { version = "0.10.0", path = "../../../lib/core/libimagstore" }
|
||||
libimagentrydatetime = { version = "0.10.0", path = "../../../lib/entry/libimagentrydatetime" }
|
||||
libimagentrytag = { version = "0.10.0", path = "../../../lib/entry/libimagentrytag" }
|
||||
libimagentryutil = { version = "0.10.0", path = "../../../lib/entry/libimagentryutil" }
|
||||
|
|
|
@ -47,8 +47,8 @@ extern crate lazy_static;
|
|||
extern crate is_match;
|
||||
#[macro_use] extern crate failure;
|
||||
|
||||
#[macro_use]
|
||||
extern crate libimagstore;
|
||||
#[macro_use] extern crate libimagstore;
|
||||
#[macro_use] extern crate libimagentryutil;
|
||||
extern crate libimagentrydatetime;
|
||||
extern crate libimagentrytag;
|
||||
extern crate libimagerror;
|
||||
|
|
|
@ -32,10 +32,11 @@ use failure::Error;
|
|||
use libimagstore::store::Store;
|
||||
use libimagstore::store::FileLockEntry;
|
||||
use libimagentrydatetime::datepath::compiler::DatePathCompiler;
|
||||
use libimagentryutil::isa::Is;
|
||||
|
||||
use crate::constants::*;
|
||||
use crate::iter::get::TimeTrackingsGetIterator;
|
||||
|
||||
use crate::timetracking::IsTimeTracking;
|
||||
use crate::tag::TimeTrackingTag as TTT;
|
||||
|
||||
pub trait TimeTrackStore<'a> {
|
||||
|
@ -93,6 +94,9 @@ impl<'a> TimeTrackStore<'a> for Store {
|
|||
.map_err(Error::from)
|
||||
.map(|_| fle)
|
||||
})
|
||||
.and_then(|mut fle| {
|
||||
fle.set_isflag::<IsTimeTracking>().map(|_| fle)
|
||||
})
|
||||
}
|
||||
|
||||
fn create_timetracking(&'a self, start: &NDT, end: &NDT, ts: &TTT) -> Result<FileLockEntry<'a>> {
|
||||
|
|
|
@ -28,6 +28,8 @@ use chrono::naive::NaiveDateTime;
|
|||
|
||||
use libimagstore::store::Entry;
|
||||
use libimagerror::errors::ErrorMsg as EM;
|
||||
use libimagentryutil::isa::Is;
|
||||
use libimagentryutil::isa::IsKindHeaderPathProvider;
|
||||
|
||||
use crate::tag::TimeTrackingTag as TTT;
|
||||
use crate::constants::*;
|
||||
|
@ -40,8 +42,12 @@ use failure::Fallible as Result;
|
|||
use failure::ResultExt;
|
||||
use failure::Error;
|
||||
|
||||
provide_kindflag_path!(pub IsTimeTracking, "timetrack.is_timetracking");
|
||||
|
||||
pub trait TimeTracking {
|
||||
|
||||
fn is_timetracking(&self) -> Result<bool>;
|
||||
|
||||
fn get_timetrack_tag(&self) -> Result<TTT>;
|
||||
|
||||
fn set_start_datetime(&mut self, dt: NaiveDateTime) -> Result<()>;
|
||||
|
@ -62,6 +68,10 @@ pub trait TimeTracking {
|
|||
|
||||
impl TimeTracking for Entry {
|
||||
|
||||
fn is_timetracking(&self) -> Result<bool> {
|
||||
self.is::<IsTimeTracking>().map_err(From::from)
|
||||
}
|
||||
|
||||
fn get_timetrack_tag(&self) -> Result<TTT> {
|
||||
self.get_header()
|
||||
.read_string(DATE_TIME_TAG_HEADER_PATH)
|
||||
|
|
Loading…
Reference in a new issue