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" }
|
libimagrt = { version = "0.6.0", path = "../../../lib/core/libimagrt" }
|
||||||
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }
|
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }
|
||||||
libimagtimetrack = { version = "0.6.0", path = "../../../lib/domain/libimagtimetrack" }
|
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 libimagstore;
|
||||||
extern crate libimagrt;
|
extern crate libimagrt;
|
||||||
extern crate libimagtimetrack;
|
extern crate libimagtimetrack;
|
||||||
|
extern crate libimagutil;
|
||||||
|
|
||||||
mod cont;
|
mod cont;
|
||||||
mod day;
|
mod day;
|
||||||
|
|
|
@ -29,9 +29,10 @@ use libimagrt::runtime::Runtime;
|
||||||
use libimagtimetrack::timetracking::TimeTracking;
|
use libimagtimetrack::timetracking::TimeTracking;
|
||||||
use libimagtimetrack::tag::TimeTrackingTag;
|
use libimagtimetrack::tag::TimeTrackingTag;
|
||||||
use libimagtimetrack::timetrackingstore::*;
|
use libimagtimetrack::timetrackingstore::*;
|
||||||
use libimagtimetrack::iter::get::GetTimeTrackIter;
|
|
||||||
use libimagtimetrack::iter::filter::has_end_time;
|
use libimagtimetrack::iter::filter::has_end_time;
|
||||||
use libimagtimetrack::iter::filter::has_one_of_tags;
|
use libimagtimetrack::iter::filter::has_one_of_tags;
|
||||||
|
use libimagutil::warn_result::*;
|
||||||
|
use libimagutil::debug_result::*;
|
||||||
|
|
||||||
pub fn stop(rt: &Runtime) -> i32 {
|
pub fn stop(rt: &Runtime) -> i32 {
|
||||||
let (_, cmd) = rt.cli().subcommand();
|
let (_, cmd) = rt.cli().subcommand();
|
||||||
|
@ -74,41 +75,25 @@ pub fn stop(rt: &Runtime) -> i32 {
|
||||||
.collect()
|
.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));
|
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.
|
// Filter all timetrackings for the ones that are not yet ended.
|
||||||
iter.trace_unwrap()
|
.filter(|e| filter.filter(e))
|
||||||
.filter_map(|elem| {
|
|
||||||
if filter.filter(&elem) {
|
|
||||||
Some(elem)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// for each of these timetrackings, end them
|
// for each of these timetrackings, end them
|
||||||
// for each result, print the backtrace (if any)
|
// for each result, print the backtrace (if any)
|
||||||
.fold(0, |acc, mut elem| match elem.set_end_datetime(stop_time.clone()) {
|
.fold(0, |acc, mut elem| {
|
||||||
Err(e) => { // if there was an error
|
elem.set_end_datetime(stop_time.clone())
|
||||||
trace_error(&e); // trace
|
.map_dbg(|e| format!("Setting end time worked: {:?}", e))
|
||||||
1 // set exit code to 1
|
.map(|_| acc)
|
||||||
},
|
.map_err_trace_exit_unwrap(1)
|
||||||
Ok(_) => {
|
|
||||||
debug!("Setting end time worked: {:?}", elem);
|
|
||||||
|
|
||||||
// Keep the exit code
|
|
||||||
acc
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue