Skip to content

feat: stats, log, export + CSV and JSON Data Exports#3

Merged
DylanDevelops merged 6 commits into
mainfrom
ravel/prototype-data-management
Dec 8, 2025
Merged

feat: stats, log, export + CSV and JSON Data Exports#3
DylanDevelops merged 6 commits into
mainfrom
ravel/prototype-data-management

Conversation

@DylanDevelops
Copy link
Copy Markdown
Owner

This pull request introduces three major new CLI commands—export, log, and stats—to enhance time tracking functionality, and adds supporting database query methods and export utilities for CSV and JSON formats. It also includes documentation and utility improvements for the TimeEntry model. These changes enable users to view, filter, and export their time tracking data with flexible options.

New CLI Commands:

  • Added export command to output time entries in CSV or JSON format, with options to filter by date or project (cmd/export.go).
  • Added log command to display time entry history, supporting filters for project, today, week, and entry limit (cmd/log.go).
  • Added stats command to show time tracking statistics for today, this week, or all time, including per-project breakdown and estimated earnings (cmd/stats.go).

Database and Query Enhancements:

  • Implemented new methods in Database: GetEntries, GetEntriesByProject, GetEntriesByDateRange, and GetAllProjects to support flexible data retrieval for the new commands (internal/storage/db.go).

Export Utilities:

  • Added ToCSV and ToJson functions for exporting time entries to CSV and JSON files, respectively (internal/export/csv.go, internal/export/json.go). [1] [2]

Model Documentation and Utilities:

  • Documented the TimeEntry struct and added IsRunning and improved Duration methods for better code clarity and utility (internal/storage/models.go). [1] [2] [3]

Implements GetEntries, GetEntriesByProject, GetEntriesByDateRange, and GetAllProjects methods for retrieving time entries and distinct project names from the database. These methods support filtering by project, date range, and limiting results, improving data access flexibility.
Introduces a new 'log' command to display time tracking history with filtering options for limit, project, today, and week. Integrates with storage to fetch and format entries, showing total tracked time and entry details.
Added detailed comments to the TimeEntry struct and its methods Duration and IsRunning to clarify their purpose and usage.
Introduces an 'export' CLI command to export time entries in CSV or JSON format. Implements internal/export/csv.go and internal/export/json.go for file generation, supporting filtering by date and project.
Introduces a new 'stats' command to display time tracking statistics by day, week, or all-time. Also includes minor formatting fixes in export.go and log.go command definitions.
Added detailed doc comments for ShowPeriodStats and ShowAllTimeStats functions in cmd/stats.go, describing their behavior, aggregation logic, and output. This improves code readability and helps future maintainers understand the purpose and implementation details of these functions.
@DylanDevelops DylanDevelops merged commit efed7fe into main Dec 8, 2025
@DylanDevelops DylanDevelops deleted the ravel/prototype-data-management branch December 8, 2025 05:47
@DylanDevelops DylanDevelops changed the title [add] stats, log, export + CSV and JSON Data Exports feat: stats, log, export + CSV and JSON Data Exports Dec 11, 2025
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.

1 participant