pub trait ActivityQuerying: ActivityReadOps {
Show 16 methods // Required methods fn group_activities_by_duration_range( &self ) -> PaceOptResult<BTreeMap<PaceDurationRange, Vec<ActivityItem>>>; fn group_activities_by_start_date( &self ) -> PaceOptResult<BTreeMap<PaceDate, Vec<ActivityItem>>>; fn list_activities_with_intermissions( &self ) -> PaceOptResult<BTreeMap<ActivityGuid, Vec<ActivityItem>>>; fn group_activities_by_keywords( &self, keyword_opts: KeywordOptions ) -> PaceOptResult<BTreeMap<String, Vec<ActivityItem>>>; fn group_activities_by_kind( &self ) -> PaceOptResult<BTreeMap<ActivityKind, Vec<ActivityItem>>>; fn list_activities_by_time_range( &self, time_range_opts: TimeRangeOptions ) -> PaceOptResult<Vec<ActivityGuid>>; fn group_activities_by_status( &self ) -> PaceOptResult<BTreeMap<ActivityStatus, Vec<ActivityItem>>>; fn list_activities_by_id( &self ) -> PaceOptResult<BTreeMap<ActivityGuid, Activity>>; // Provided methods fn list_current_activities( &self, filter: ActivityFilterKind ) -> PaceOptResult<Vec<ActivityGuid>> { ... } fn list_active_intermissions(&self) -> PaceOptResult<Vec<ActivityGuid>> { ... } fn list_most_recent_activities( &self, count: usize ) -> PaceOptResult<Vec<ActivityGuid>> { ... } fn is_activity_active(&self, activity_id: ActivityGuid) -> PaceResult<bool> { ... } fn list_intermissions_for_activity_id( &self, activity_id: ActivityGuid ) -> PaceOptResult<Vec<ActivityItem>> { ... } fn list_active_intermissions_for_activity_id( &self, activity_id: ActivityGuid ) -> PaceOptResult<Vec<ActivityGuid>> { ... } fn most_recent_active_activity(&self) -> PaceOptResult<ActivityItem> { ... } fn most_recent_held_activity(&self) -> PaceOptResult<ActivityItem> { ... }
}
Expand description

Querying Activities

Querying activities is a way to get information about them from the storage backend. This is useful for getting a list of activities, finding activities within a specific date range, or getting activities by their ID.

For example, you might want to list all activities that are currently active, find all activities within a specific date range, or get a specific activity by its ID.

Required Methods§

source

fn group_activities_by_duration_range( &self ) -> PaceOptResult<BTreeMap<PaceDurationRange, Vec<ActivityItem>>>

Group activities by predefined duration ranges (e.g., short, medium, long).

This is useful for analyzing how time is spent on different activities.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are grouped by their duration range. The key is the duration range, and the value is a list of activities that fall within that range. If no activities are found, it should return Ok(None).

source

fn group_activities_by_start_date( &self ) -> PaceOptResult<BTreeMap<PaceDate, Vec<ActivityItem>>>

Group activities by their start date. This can help in analyzing how activities are distributed over time.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are grouped by their start date. The key is the start date of the activity, and the value is a list of activities that started on that date.

source

fn list_activities_with_intermissions( &self ) -> PaceOptResult<BTreeMap<ActivityGuid, Vec<ActivityItem>>>

Retrieve activities that have one or more intermissions, useful for identifying potential inefficiencies or breaks.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that have intermissions. The key is the ID of the activity, and the value is a list of intermissions. If no activities are found, it should return Ok(None).

source

fn group_activities_by_keywords( &self, keyword_opts: KeywordOptions ) -> PaceOptResult<BTreeMap<String, Vec<ActivityItem>>>

Group activities based on keywords, e.g., category, tags, etc.

This is useful for analyzing time spent on different projects or areas of work.

§Arguments
  • keyword_opts - The keyword options to filter the activities by.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are matching the KeywordOptions. The key is the keyword, and the value is a list of matching activities. If no activities are found, it should return Ok(None).

source

fn group_activities_by_kind( &self ) -> PaceOptResult<BTreeMap<ActivityKind, Vec<ActivityItem>>>

Group activities based on their kind (e.g., Task, Intermission).

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities with their kind. The key is the kind of the activity, and the value is a list of activities of that kind. If no activities are found, it should return Ok(None).

source

fn list_activities_by_time_range( &self, time_range_opts: TimeRangeOptions ) -> PaceOptResult<Vec<ActivityGuid>>

List activities by time range from the storage backend.

§Arguments
  • time_range_opts - The range options to filter the activities by.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities guids that are matching the RangeOptions. If no activities are found, it should return Ok(None).

source

fn group_activities_by_status( &self ) -> PaceOptResult<BTreeMap<ActivityStatus, Vec<ActivityItem>>>

Group activities by their status from the storage backend.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities by their status. If no activities are found, it should return Ok(None).

source

fn list_activities_by_id( &self ) -> PaceOptResult<BTreeMap<ActivityGuid, Activity>>

Get all activities by their ID.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that were loaded from the storage backend by their ID in a BTreeMap. If no activities are found, it should return Ok(None).

Provided Methods§

source

fn list_current_activities( &self, filter: ActivityFilterKind ) -> PaceOptResult<Vec<ActivityGuid>>

List all current activities from the storage backend matching an ActivityFilter.

§Errors

This function should return an error if the activities cannot be loaded. In case of no activities, it should return Ok(None).

§Returns

A collection of the activities that are matching the ActivityFilter.

source

fn list_active_intermissions(&self) -> PaceOptResult<Vec<ActivityGuid>>

List all active intermissions from the storage backend.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are currently active intermissions. If no activities are found, it should return Ok(None).

source

fn list_most_recent_activities( &self, count: usize ) -> PaceOptResult<Vec<ActivityGuid>>

List the most recent activities from the storage backend.

§Arguments
  • count - The number of activities to list.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the most recent activities. If no activities are found, it should return Ok(None).

source

fn is_activity_active(&self, activity_id: ActivityGuid) -> PaceResult<bool>

Check if an activity is currently active.

§Arguments
  • activity_id - The ID of the activity to check.
§Errors

This function should return an error if the activity cannot be checked.

§Returns

If the activity is active, it should return Ok(true). If it is not active, it should return Ok(false).

source

fn list_intermissions_for_activity_id( &self, activity_id: ActivityGuid ) -> PaceOptResult<Vec<ActivityItem>>

List all intermissions for an activity id from the storage backend.

§Arguments
  • activity_id - The ID of the activity to list intermissions for.
§Errors

This function should return an error if the intermissions cannot be loaded.

§Returns

A collection of the intermissions for the activity. If no intermissions are found, it should return Ok(None).

source

fn list_active_intermissions_for_activity_id( &self, activity_id: ActivityGuid ) -> PaceOptResult<Vec<ActivityGuid>>

Check if an activity currently has one or more active intermissions.

§Arguments
  • activity_id - The ID of the activity to check.
§Errors

This function should return an error if the activity cannot be checked.

§Returns

If the activity has active intermissions, it should return Ok(Option<VecDeque<ActivityGuid>>) with the IDs of the active intermissions. If it has no active intermissions, it should return Ok(None).

source

fn most_recent_active_activity(&self) -> PaceOptResult<ActivityItem>

Get the latest active activity.

§Errors

This function should return an error if the activity cannot be loaded.

§Returns

The latest active activity. If no activity is found, it should return Ok(None).

source

fn most_recent_held_activity(&self) -> PaceOptResult<ActivityItem>

Get the latest held activity.

§Errors

This function should return an error if the activity cannot be loaded.

§Returns

The latest held activity. If no activity is found, it should return Ok(None).

Implementors§