From 2bb51244a4c8e92b385e973efde71263c90c8e1b Mon Sep 17 00:00:00 2001 From: hardliner66 Date: Mon, 19 Apr 2021 07:56:31 +0200 Subject: [PATCH] only use min break time if there is at least one break --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc5fcec..29e88c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,7 +399,7 @@ dependencies = [ [[package]] name = "timetracking" -version = "1.5.15-alpha.0" +version = "1.5.15" dependencies = [ "anyhow", "bincode", diff --git a/Cargo.toml b/Cargo.toml index e10ce3a..cce7929 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "timetracking" description = "Simple time tracker with simple data format" -version = "1.5.15-alpha.0" +version = "1.5.15" authors = ["hardliner66 "] edition = "2018" license-file = "LICENSE" diff --git a/src/main.rs b/src/main.rs index 325c4c0..6800202 100644 --- a/src/main.rs +++ b/src/main.rs @@ -520,7 +520,7 @@ fn get_time_from_day( let total = last.unwrap_or(now) - first.unwrap_or(now); let pause = total - work_day; let min_break_duration = Duration::minutes(i64::from(settings.min_daily_break)); - if pause < min_break_duration { + if pause > Duration::zero() && pause < min_break_duration { let difference = min_break_duration - pause; work_day = work_day - difference; }