Refactor: Minify
Pull in new dependencies for minification
This commit is contained in:
parent
4bd156fdb3
commit
82b67115e6
3 changed files with 20 additions and 33 deletions
|
@ -31,3 +31,4 @@ libimagstore = { version = "0.6.0", path = "../../../lib/core/libimagstore"
|
|||
libimagrt = { version = "0.6.0", path = "../../../lib/core/libimagrt" }
|
||||
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }
|
||||
libimagtimetrack = { version = "0.6.0", path = "../../../lib/domain/libimagtimetrack" }
|
||||
libimagutil = { version = "0.6.0", path = "../../../lib/etc/libimagutil" }
|
||||
|
|
|
@ -30,6 +30,7 @@ extern crate libimagerror;
|
|||
extern crate libimagstore;
|
||||
extern crate libimagrt;
|
||||
extern crate libimagtimetrack;
|
||||
extern crate libimagutil;
|
||||
|
||||
mod cont;
|
||||
mod day;
|
||||
|
|
|
@ -29,9 +29,10 @@ use libimagrt::runtime::Runtime;
|
|||
use libimagtimetrack::timetracking::TimeTracking;
|
||||
use libimagtimetrack::tag::TimeTrackingTag;
|
||||
use libimagtimetrack::timetrackingstore::*;
|
||||
use libimagtimetrack::iter::get::GetTimeTrackIter;
|
||||
use libimagtimetrack::iter::filter::has_end_time;
|
||||
use libimagtimetrack::iter::filter::has_one_of_tags;
|
||||
use libimagutil::warn_result::*;
|
||||
use libimagutil::debug_result::*;
|
||||
|
||||
pub fn stop(rt: &Runtime) -> i32 {
|
||||
let (_, cmd) = rt.cli().subcommand();
|
||||
|
@ -74,41 +75,25 @@ pub fn stop(rt: &Runtime) -> i32 {
|
|||
.collect()
|
||||
});
|
||||
|
||||
let iter : GetTimeTrackIter = match rt.store().get_timetrackings() {
|
||||
Ok(i) => i,
|
||||
Err(e) => {
|
||||
error!("Getting timetrackings failed");
|
||||
trace_error(&e);
|
||||
return 1
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
let filter = has_end_time.not().and(has_one_of_tags(&tags));
|
||||
rt
|
||||
.store()
|
||||
.get_timetrackings()
|
||||
.map_warn_err_str("Getting timetrackings failed")
|
||||
.map_err_trace_exit_unwrap(1)
|
||||
.trace_unwrap()
|
||||
|
||||
// Filter all timetrackings for the ones that are not yet ended.
|
||||
iter.trace_unwrap()
|
||||
.filter_map(|elem| {
|
||||
if filter.filter(&elem) {
|
||||
Some(elem)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.filter(|e| filter.filter(e))
|
||||
|
||||
// for each of these timetrackings, end them
|
||||
// for each result, print the backtrace (if any)
|
||||
.fold(0, |acc, mut elem| match elem.set_end_datetime(stop_time.clone()) {
|
||||
Err(e) => { // if there was an error
|
||||
trace_error(&e); // trace
|
||||
1 // set exit code to 1
|
||||
},
|
||||
Ok(_) => {
|
||||
debug!("Setting end time worked: {:?}", elem);
|
||||
|
||||
// Keep the exit code
|
||||
acc
|
||||
}
|
||||
.fold(0, |acc, mut elem| {
|
||||
elem.set_end_datetime(stop_time.clone())
|
||||
.map_dbg(|e| format!("Setting end time worked: {:?}", e))
|
||||
.map(|_| acc)
|
||||
.map_err_trace_exit_unwrap(1)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue