Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/plugins/gdarquie_work/work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ pub fn compute_monthly_work_stats(month: Option<&str>) -> Result<MonthlyWorkStat
.or_default()
.push(annotation);
}

// Discard workdays that do not belong to the requested month.
Comment thread
gdarquie marked this conversation as resolved.
// This prevents phantom annotations written into the first file of a month
// (created when end_work crosses midnight from the previous month) from
// being counted as extra work days in the current month's stats.
let month_prefix = date.format("%Y-%m").to_string();
annotations_hmap.retain(|workday, _| workday.starts_with(&month_prefix));

// prepare work stats by week
let mut work_stats_by_week: HashMap<WeekId, WorkStatsByWeek> = HashMap::new();
let mut total_duration = 0;
Expand Down