Skip to content

serrnovik/TagBasedTimeTracker

This branch is 7 commits ahead of, 2 commits behind Ellpeck/ObsidianSimpleTimeTracker:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a825ffc ยท Nov 4, 2024

History

94 Commits
Nov 4, 2024
Nov 4, 2024
Aug 11, 2023
Sep 8, 2023
Nov 4, 2024
Nov 4, 2024
Nov 4, 2024
Nov 4, 2024
Nov 4, 2024
Nov 4, 2024
Nov 4, 2024
Nov 4, 2024
May 22, 2023
Aug 9, 2024

Repository files navigation

Tag-Based Time Tracker

A screenshot of the plugin in action

This is a fork of super-simple-plugin designed to provide out-of-the-box easy summaries based on tags within tracking records. The motivation for this fork comes from the need for straightforward time tracking with easy summaries and total time calculations. While the original plugin aimed to remain 'simple' and could achieve these features through dataview, I believe that native summary features offer a more user friendly solution."

TLDR

  1. Execute the Tag Based Time Tracker: Insert Time Tracker command to start logging.
  2. Set your tags in the settings in YAML format:
streams:
  name: "๐ŸŒŠ Streams"
  items:
    - topic: "Accounting"
      icon: "๐Ÿงฎ"
      tag: "#tt_accounting"
      subTags: []
    - topic: "Development"
      icon: "๐Ÿ’—"
      tag: "#tt_dev"
  1. Execute Insert Time Tracking Summary to get a summary for the desired time interval.

Description

A time tracker is essentially a special code block that stores information about the times you pressed the Start and End buttons. Since time is tracked solely through timestamps, you can switch notes, close Obsidian, or even shut down your device completely while the tracker is running! When you come back, your time tracker will still be running.

The tracker's information is stored in the code block as JSON data. The names, start times, and end times of each segment are stored and displayed neatly in the code block in preview or reading mode.

Time Tracking Summary / Reporting

  1. Time Tracking Entries with Tags: Track work sessions with tags to categorize different activities.

    • Example of an entry: #tt_dev #tt_client_a #tt_frontend represents time spent working on frontend development for a specific client.
  2. Enhanced Reporting Functionality: Generate time tracking reports for specific time periods, allowing detailed insight into how time was allocated.

    • Topic-based Reports: View summaries of time spent based on specific topics, such as Development, Accounting, etc.
    • Multiple Parallel Topics Possible: Track multiple dimensions.
    • Subtags: Track specific tags and group time tracking summaries in a markdown file. This will generate a report for a given period, optionally filtered by a specific topic.
# You can have as many 'sections' as you want to track different domains separately or in parallel

# Example section / topic 1
streams:
  name: "๐ŸŒŠ Streams"
  items:
    - topic: "Accounting"
      icon: "๐Ÿงฎ"
      tag: "#tt_accounting"
      subTags: []

    - topic: "Development"
      icon: "๐Ÿ’—"
      tag: "#tt_dev"
      subTags:
        - topic: "Frontend"
          tag: "#tt_frontend"
          subTags: []

        - topic: "Backend"
          tag: "#tt_backend"
          subTags: []

# Example section / topic 2
clients: 
  name: "๐Ÿ‘จ๐Ÿผโ€๐Ÿ’ผ Clients"
  items:
    - topic: "Client A"
      tag: "#tt_client_a"
      subTags: []

    - topic: "Client B"
      tag: "#tt_client_b"
      subTags: []

Tracker Data in Dataview

Tag Based Time Tracker has a public API that can be used with Dataview, specifically DataviewJS, which can be accessed using the following code:

dv.app.plugins.plugins["tag-based-time-tracker"].api;

The following is a short example that uses DataviewJS to load all trackers in the vault and print the total duration of each tracker:

// Get the time tracker plugin API instance
let api = dv.app.plugins.plugins["tag-based-time-tracker"].api;

for (let page of dv.pages()) {
    // Load trackers in the file with the given path
    let trackers = await api.loadAllTrackers(page.file.path);

    if (trackers.length)
        dv.el("strong", "Trackers in " + page.file.name);

    for (let { section, tracker } of trackers) {
        // Print the total duration of the tracker
        let duration = api.getTotalDuration(tracker.entries);
        dv.el("p", api.formatDuration(duration));
    }
}

About

Multi-purpose time trackers for your notes!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 93.3%
  • JavaScript 3.5%
  • CSS 3.2%