Skip to main content

Module report

Module report 

Source
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;
use chrono::Local;

let workday = Workday {
    id: 1,
    date: Local::now().date_naive(),
    start: Local::now().naive_local(),
    end: Some(Local::now().naive_local()),
};

let pauses: Vec<Pause> = 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§

ShortIntervalsInfo
Information about short intervals detected in a workday.
WorkInterval
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
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.
workday_end_time
Calculates work intervals for a given workday based on pause records.