Expand description
Work interval calculation and productivity analysis for daily reports.
Provides core logic for analyzing work patterns and generating detailed reports about productivity, work intervals, and break patterns.
§Features
- Work Interval Analysis: Convert workday and pause data into continuous work periods
- Productivity Metrics: Calculate efficiency ratios and work pattern analysis
- Short Interval Detection: Identify and analyze brief work periods that may indicate interruptions
- Interval Filtering: Filter out short intervals for cleaner reporting (display-level, no database changes)
- Report Generation: Comprehensive breakdown of workdays with productivity analysis
§Usage
use kasl::libs::report::{calculate_work_intervals, filter_short_intervals, WorkInterval};
use kasl::db::workdays::Workday;
use kasl::libs::pause::Pause;
let workday = Workday {
start: start_time,
end: Some(end_time),
};
let pauses = vec![/* pause data */];
let intervals = calculate_work_intervals(&workday, &pauses);
// Filter short intervals for cleaner reporting
let (filtered_intervals, filter_info) = filter_short_intervals(&intervals, 30);Structs§
- Short
Intervals Info - Information about short intervals detected in a workday.
- Work
Interval - Represents a single continuous work interval between breaks.
Functions§
- analyze_
short_ intervals - Analyzes work intervals to identify short periods that may indicate poor productivity.
- calculate_
work_ intervals - Calculates work intervals for a given workday based on pause records.
- combine_
breaks_ and_ pauses - Combines breaks and pauses into a unified collection for work interval calculation.
- filter_
short_ intervals - Filters out short work intervals from the provided interval list.
- report_
with_ intervals - Process daily work report data using pre-calculated intervals.