Compare commits

..

No commits in common. "914a57692f0f89456ca1929ee71909fb869d8554" and "7f4ab49c915c21e88318a2d0388b7614aa1196b6" have entirely different histories.

5 changed files with 6 additions and 13 deletions

View File

@ -57,8 +57,8 @@ if [[ -f ${DATE} ]]; then
subtotal=0
for pattern in "${KEYS[@]}"; do
#echo "pattern=${pattern}" >&2
$grep -- "\[${pattern}\]" ${DATE} | python timetracker.py
subtotal=$(bc <<< "scale=2; ${subtotal} + $($grep -- "\[${pattern}\]" ${DATE} | python timetracker.py | $grep "Section" | $grep -Po '\d+\.\d+hrs' | tr -d '[hrs]')")
$grep -- "\[${pattern}\]" ${DATE} | timetracker
subtotal=$(bc <<< "scale=2; ${subtotal} + $($grep -- "\[${pattern}\]" ${DATE} | timetracker | $grep "Section" | $grep -Po '\d+\.\d+hrs' | tr -d '[hrs]')")
printf "Subtotal: %3.2fhrs\n" ${subtotal}
echo
if [[ "${WHOLE}x" == "x" ]]; then

View File

@ -130,7 +130,7 @@ dependencies = [
]
[[package]]
name = "doprocess"
name = "do_process"
version = "0.1.0"
dependencies = [
"itertools",

View File

@ -2,7 +2,7 @@
members = [
"timetracker",
"doprocess",
"do_process",
"chug",
"timelogging"
]

View File

@ -1,5 +1,5 @@
[package]
name = "doprocess"
name = "do_process"
version = "0.1.0"
edition = "2021"

View File

@ -6,9 +6,6 @@ use itertools::Itertools;
use timelogging::timetracking::{nearest, process_input_file, generate_individual_timecards};
fn main() {
// set up a regex for escaping regex characters
let cat_esc = Regex::new(r"(?P<char>[-*^$+?])").unwrap();
// Process the file (stdin or file argument)
let input = env::args().nth(1);
let mut reader: Box<dyn BufRead> = match input {
@ -27,10 +24,7 @@ fn main() {
let mut running_total: f64 = 0.0;
for cat in categories {
let mut subtotal: f64 = 0.0;
let catre = Regex::new(&format!(r"\[{}\]\s+.*\s*$",
cat_esc.replace_all(&cat, r"\$char".to_string()))
.to_string())
.unwrap();
let catre = Regex::new(&format!(r"\[{}\]\s+.*\s*$", cat).to_string()).unwrap();
for (act, duration) in ind.iter().sorted_by_key(|x| x.0) {
if ! catre.is_match(&act.to_string()) {
continue
@ -55,4 +49,3 @@ fn main() {
println!("{}", format!("Grand total: {:.2}", gtoth));
}