Skip to content

Conversation

zyrikby
Copy link

@zyrikby zyrikby commented Jun 9, 2025

This pull request adds functionality of getting the data about the previous periods.
It also adds configuration of the first day of the week (it was before in a separate PR, however, I decided to combine them).
In this pull request, I've deleted the information about when the periods start because this makes the code more complicated (especially, if you want to add the same format for all types of periods).

Closes #36

twentyTwo and others added 21 commits May 25, 2025 09:07
correct run-name in repository statistics workflow

add push trigger for action/repo-stats branch in repository statistics workflow

refactor: move permissions section to top and update token reference in repo-stats workflow

fix: update run-name formatting and remove push trigger from repository statistics workflow
add repository statistics workflow for automated metrics collection
)

Add *.code-workspace files to git and vscode ignore files.
This allows `npm test` to execute eslint.
* feat: add branch tracking and view storage data command

* feat: add documentation for time tracking mechanism and todo list

* feat: enhance branch tracking

* feat: add project-specific branch filtering and update UI for branch selection

* feat: add command to clear all time tracking data with confirmation prompt

* feat: enhance project and branch tracking in documentation and update usage instructions

* Update package.json
This commit allows a user to set what day is the start of the week. The
user now can select what day is the week start day in the configuration.
This commit adds the information about the previous periods, namely,
last week, last month and last year. It also optimizes the calculation
of time by iterating over TimeEntries only once.
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the extension by adding Git branch–aware tracking, configurable week start, and reporting for previous periods, along with data‐management commands.

  • Track and save coding sessions per Git branch and compute totals for yesterday, last week/month/year.
  • Add weekStartDay configuration and update summary UI with branch filters.
  • Register new commands for viewing and clearing stored data and update status bar to include branch info.

Reviewed Changes

Copilot reviewed 13 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/timeTracker.ts Introduce Git watcher, branch tracking, weekStartDay, and getAllPeriodTotals
src/summaryView.ts Extend search, UI, and message payload to support branch filtering
src/statusBar.ts Switch to getAllPeriodTotals, display current branch in tooltip
src/extension.ts Add viewStorageData & clearAllData commands
src/database.ts Migrate existing entries, add branch field, branch summary & filtering
package.json Bump version, add weekStartDay setting and adjust saveInterval default
README.md Update features and config section to reflect branch tracking and new defaults
Comments suppressed due to low confidence (5)

package.json:64

  • [nitpick] The command ID uses a different prefix (coding-time-tracker) than the rest (simpleCodingTimeTracker). Rename to simpleCodingTimeTracker.clearAllData for consistency.
        "command": "coding-time-tracker.clearAllData",

src/statusBar.ts:1

  • The StatusBar class implements Disposable but lacks a dispose() method to clear the interval and hide the status bar item. Add a dispose() that calls clearInterval(this.updateInterval) and this.statusBarItem.dispose().
import * as vscode from 'vscode';

src/timeTracker.ts:271

  • The new getAllPeriodTotals method has complex date logic and branch inclusion. Consider adding unit tests to verify period boundaries and branch filtering.
    async getAllPeriodTotals(): Promise<{

README.md:57

  • The default saveInterval was changed to 30 seconds in package.json. Update the README to reflect the new default.
     - Default: 5 seconds

src/timeTracker.ts:231

  • The external-file handling logic was removed, so files outside the workspace now fall back to the first folder name. Restore logic to detect External/... for out-of-workspace files.
        if (workspaceFolders.length === 1) {

this.panel.reveal();
this.panel.webview.html = this.getHtmlForWebview(projects);
this.panel.webview.postMessage({ command: 'update', data: summaryData, projects: projects, totalTime: totalTime });
this.panel.webview.postMessage({ command: 'update', data: summaryData, projects, totalTime, configData });
Copy link
Preview

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The panel update message omits the branches property, so the branch dropdown won't populate when using the panel. Include branches in the payload like the webview view.

Suggested change
this.panel.webview.postMessage({ command: 'update', data: summaryData, projects, totalTime, configData });
this.panel.webview.postMessage({ command: 'update', data: summaryData, projects, branches, totalTime, configData });

Copilot uses AI. Check for mistakes.

Comment on lines 163 to 168
if (!this.isTracking) {
this.startTracking();
await this.startTracking();
}

// Update the last activity timestamp
this.lastCursorActivity = Date.now();

// Reset and setup the inactivity timer
this.setupCursorTracking();
Copy link
Preview

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This async method is called from event callbacks without awaiting or catching errors. Consider catching rejections or removing async if not needed to avoid unhandled promise rejections.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "yesterday" and "last week"
3 participants