Skip to content

feat: period report export (#22)#24

Merged
wiseelf merged 4 commits into
mainfrom
feature/period-report
Jun 27, 2026
Merged

feat: period report export (#22)#24
wiseelf merged 4 commits into
mainfrom
feature/period-report

Conversation

@wiseelf

@wiseelf wiseelf commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds ReportGenerator (pure logic in TimeTrackerCore) that produces per-day rows
    with tracked hours, on-call hours, and amounts (when income tracking is enabled)
  • Adds ReportPickerSheet — a period selector sheet shown before the save dialog
  • Report button in Stats tab opens the picker; Export/Import (JSON backup) moved to
    On-call Settings page
  • Saves a Markdown .md file via NSSavePanel with a period-based filename

Period options

Option Example filename
This Week time-report-jun-23-29-2026.md
Last Week time-report-jun-16-22-2026.md
This Month time-report-june-2026.md
Last Month time-report-may-2026.md
Custom Range time-report-jun-1-jun-30-2026.md

Report format

# Time Report — Jun 23–29, 2026

| Date       | Hours | Amount  | On-call | OC Amount |
|------------|------:|--------:|--------:|----------:|
| Mon Jun 23 |  7:30 | $120.00 |    8:00 |    $48.00 |
| Tue Jun 24 |  8:00 | $128.00 |       — |         — |

Regular:   15:30   $248.00
On-call:    8:00    $48.00
Total:              $296.00

Amount columns appear only when income tracking is enabled. On-call columns are
optional via a toggle in the picker. Days with no tracked time and no on-call are omitted.

New files

  • Sources/TimeTrackerCore/ReportGenerator.swiftReportRow, ReportData, ReportGenerator.generate
  • Sources/TimeTracker/ReportPickerSheet.swift — period picker sheet (5 options + custom date range + on-call toggle)

Modified files

  • Sources/TimeTracker/StatsView.swift — Report button opens picker; Export/Import removed
  • Sources/TimeTracker/OnCallSettingsSection.swift — Export/Import (JSON backup) moved here

Test plan

  • swift build clean
  • Stats tab: Report button opens period picker
  • All 5 period options produce correct date ranges and filenames
  • Custom range: start/end date pickers enforce start ≤ end
  • Include on-call toggle: off removes On-call/OC Amount columns and on-call totals
  • Income tracking off: no Amount/OC Amount columns
  • Days with no activity are omitted
  • On-call Settings: Export/Import work correctly from new location
  • Saved .md file opens in any Markdown viewer

wiseelf added 4 commits June 27, 2026 10:12
Generates a Markdown report for the current week/month period:
- Daily rows: date, tracked hours, on-call hours, amount, OC amount
- Period subtotals: regular and on-call separately
- Grand total
- Amount columns shown only when income tracking is enabled
- Saved as .md via NSSavePanel

New file: Sources/TimeTrackerCore/ReportGenerator.swift
Closes #22
- ReportPickerSheet: choose This Week / This Month / Custom date range
  before exporting; defaults to current Stats period
- Custom option shows From/To DatePickers
- Stats tab: Report button opens picker sheet instead of exporting immediately
- Move Export/Import (JSON backup) from Stats tab to On-call Settings section
@wiseelf wiseelf mentioned this pull request Jun 27, 2026
5 tasks
@wiseelf wiseelf merged commit 27b9745 into main Jun 27, 2026
@wiseelf wiseelf deleted the feature/period-report branch June 27, 2026 00:35
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