Use filter fn from lib

This commit is contained in:
Matthias Beyer 2017-07-20 12:29:42 +02:00
parent 85e76d6ff0
commit ecb9bcc861
2 changed files with 4 additions and 5 deletions

View file

@ -26,13 +26,12 @@ use itertools::Itertools;
use itertools::MinMaxResult; use itertools::MinMaxResult;
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use common::has_end_time;
use libimagerror::trace::trace_error; use libimagerror::trace::trace_error;
use libimagerror::trace::MapErrTrace; use libimagerror::trace::MapErrTrace;
use libimagerror::iter::TraceIterator; use libimagerror::iter::TraceIterator;
use libimagentrytimetrack::timetrackingstore::TimeTrackStore; use libimagentrytimetrack::timetrackingstore::TimeTrackStore;
use libimagentrytimetrack::timetracking::TimeTracking; use libimagentrytimetrack::timetracking::TimeTracking;
use libimagentrytimetrack::iter::filter::*;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;

View file

@ -21,8 +21,6 @@ use std::str::FromStr;
use filters::filter::Filter; use filters::filter::Filter;
use common::*;
use libimagerror::trace::trace_error; use libimagerror::trace::trace_error;
use libimagerror::iter::TraceIterator; use libimagerror::iter::TraceIterator;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
@ -32,6 +30,8 @@ use libimagentrytimetrack::timetracking::TimeTracking;
use libimagentrytimetrack::tag::TimeTrackingTag; use libimagentrytimetrack::tag::TimeTrackingTag;
use libimagentrytimetrack::timetrackingstore::*; use libimagentrytimetrack::timetrackingstore::*;
use libimagentrytimetrack::iter::get::GetTimeTrackIter; use libimagentrytimetrack::iter::get::GetTimeTrackIter;
use libimagentrytimetrack::iter::filter::has_end_time;
use libimagentrytimetrack::iter::filter::has_one_of_tags;
pub fn stop(rt: &Runtime) -> i32 { pub fn stop(rt: &Runtime) -> i32 {
let (_, cmd) = rt.cli().subcommand(); let (_, cmd) = rt.cli().subcommand();
@ -65,7 +65,7 @@ pub fn stop(rt: &Runtime) -> i32 {
}; };
let filter = has_end_time.not().and(HasTagFromList::new(&tags)); let filter = has_end_time.not().and(has_one_of_tags(&tags));
// Filter all timetrackings for the ones that are not yet ended. // Filter all timetrackings for the ones that are not yet ended.
iter.trace_unwrap() iter.trace_unwrap()