Skip to main content

Module breaks

Module breaks 

Source
Expand description

Manual break period management.

Handles user-defined break periods for productivity optimization, allowing manual addition of intentional breaks to improve productivity calculations. Manual break periods management for productivity optimization.

Handles user-defined break periods that complement automatic pause detection for improved productivity metrics.

§Features

  • Manual Break Creation: Add intentional break periods to improve productivity
  • Smart Placement: Avoid conflicts with existing pauses and maintain minimum work intervals
  • Daily Management: Retrieve and manage breaks for specific dates
  • Productivity Integration: Seamlessly integrate with productivity calculations

§Usage

use kasl::db::breaks::{Breaks, Break};
use chrono::{NaiveDate, Duration};

let breaks_db = Breaks::new()?;
let date = NaiveDate::from_ymd_opt(2025, 1, 15).unwrap();
 
let break_record = Break {
    id: None,
    date,
    start: date.and_hms_opt(12, 0, 0).unwrap(),
    end: date.and_hms_opt(12, 30, 0).unwrap(),
    duration: Duration::minutes(30),
    reason: Some("Lunch break".to_string()),
    created_at: None,
};

breaks_db.insert(&break_record)?;

Structs§

Break
Represents a manually added break period.
Breaks
Database operations for manual break management.