-
Notifications
You must be signed in to change notification settings - Fork 0
Implement comprehensive time tracking system with nytid track command using flat label tags
#230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
track command: Add any time spent on a coursenytid track command
|
@copilot don't commit the temporary files:
|
Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Fixed in commit 6f47478. Removed the incorrectly committed generated files (.py and .tex files generated from .nw sources) and temporary test files. Updated .gitignore to prevent this issue in the future by adding specific patterns for:
The track command functionality remains fully intact - all files are properly regenerated during the build process as intended by the literate programming workflow. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
dbosk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please change the following:
- better document the rationale behind the design and the different parts of the code. For example, how do the classes relate to each other?
- use the config system instead of using constants for the data locations.
Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Implemented both requested improvements in commit 93af7b2: Enhanced Documentation: Added comprehensive design rationale covering:
Configuration System Integration: Replaced hardcoded constants with nytid's config system:
The stats command now shows: "Uses configured default limits for warnings unless overridden by command options. Default limits can be set using: nytid config track.weekly_limit -s 40.0" Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
dbosk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot move the tests closer to the functions that they should test. Same with the documentation. It should be close to the code that it describes, use more code chunks if necessary.
…ove tests and documentation closer to functions Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Reorganized the entire track.nw file in commit 589c329 following nytid's literate programming best practices: Tests moved closer to functions: Each function's tests now immediately follow its implementation (e.g., TrackingEntry class → test_tracking_entry_* functions → ActiveSession class → test_active_session_* functions) Documentation closer to code: Each function/command section starts with detailed documentation explaining the rationale, followed immediately by the implementation and then tests Smaller, focused chunks: Broke large sections into smaller noweb chunks organized by functionality (e.g., Structure now follows: Documentation → Implementation → Tests → Next Function, making it easy to understand each component's purpose, see how it's implemented, and verify it works correctly. All 16 tests continue to pass with the reorganized structure. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
dbosk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot: Please fix the following:
- The labels shouldn't be hierarchical, they should be flat. More like tags.
- We should be able to stop tracking any arbitrary label, not just the last one
we started tracking. - We shouldn't be able to have the same label tracking "twice in parallel".
Starting the same label again should merge with the existing tracking, if
possible. - We should be able to add notes to any label, not just when using the
add
command. - Revise the sectioning structure in the documentation. Now the code overview
(<<track.py>>) appears in the Multi-format Export Capability section. - To manage the data, use the StorageRoot system instead of
get_tracking_dir
andget_tracking_data_file. Or at least make those functions wrap around
the StorageRoot.
|
@copilot two more things. First, when we use the run command, make the command the label and add the full command with arguments as a description. Second, let the stats command take labels as arguments and do stats on just them. |
Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Implemented all three requested features in commit 05dd3cc: 1. Batch stopping: Labels started together now stop together. 2. Resume functionality: 3. Autocompletion: Added shell completion for both commands:
The system tracks which labels were started together using batch IDs and remembers the last stopped labels in the session state. All data persists across restarts. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…o stats Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Implemented both features in commit 7c7e5ca: Run command enhancement: The command name is now automatically used as a label, and the full command with arguments is stored as a description. For example, Stats label filtering: The stats command now accepts labels as positional arguments to filter statistics. For example:
The implementation includes comprehensive tests for both features. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
dbosk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot, now the status command is broken:
$ nytid track status
Currently tracking:
╭────────────────────────── Traceback (most recent call last) ───────────────────────────╮
│ /home/dbosk/devel/edu/nytid/src/nytid/cli/track.py:634 in status │
│ │
│ 631 │ for label in session.get_active_labels(): │
│ 632 │ │ info = session.get_label_info(label) │
│ 633 │ │ if info: │
│ ❱ 634 │ │ │ start_time, notes = info │
│ 635 │ │ │ duration = current_time - start_time │
│ 636 │ │ │ notes_display = f" - {notes}" if notes else "" │
│ 637 │ │ │ typer.echo(f" {label}: {format_duration(duration)}{notes_display}" │
│ │
│ ╭────────────────────────────────── locals ───────────────────────────────────╮ │
│ │ current_time = datetime.datetime(2025, 10, 13, 21, 23, 35, 554327) │ │
│ │ info = (datetime.datetime(2025, 10, 13, 21, 20, 56, 994273), '', 1) │ │
│ │ label = 'work' │ │
│ │ session = <nytid.cli.track.ActiveSession object at 0x794f9db18ef0> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────╯ │
╰────────────────────────────────────────────────────────────────────────────────────────╯
Please fix it.
…el_info Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Fixed in commit 78d5c48. The issue was that start_time, notes, batch_id = infoThe status command now works correctly. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
dbosk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot: Please add tests so that bugs like the one above don't happen again.
Remember, add the tests close to the functions they are testing. That's better
for the readability of the code.
Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Added comprehensive status command tests in commit 513b9c7 (bug fix) and this commit. The test suite now includes 6 tests positioned immediately after the status command implementation:
The critical regression test documents exactly what bug it prevents and validates both the internal data structure and command execution, ensuring the ValueError won't happen again. |
dbosk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot: Please also ensure that everything in the tracking module is properly
tested.
The stats command was improved. However, please change so that the stats
command outputs stats for labels that have appeared along with the given
labels. So the given labels form the total time and the output shows how much
time was spent with each of the other labels that appeared along with the given
labels. For instance, given nytid track stats devel I want to see how much
time I spent in total on devel. But I also want to see how much of that total
development time was spent on nytid and how much was spent on
canvaslms---which will have been tracked as nytid track start devel canvaslms and nytid track start devel nytid.
…ehensive tracking module tests Co-authored-by: dbosk <237222+dbosk@users.noreply.github.com>
Implemented both requested changes in commit a375849: Stats co-occurring label breakdown: When filtering by labels (e.g.,
Comprehensive testing: Added two new test suites:
The stats command now answers questions like "How much of my development time was spent on nytid vs canvaslms?" by showing the breakdown of co-occurring labels. |
|
Improved in #243. |
Implementation of
trackCommand - Enhanced Stats and Comprehensive Testing ✅Implemented enhancements requested by @dbosk in comment #3332867808.
Stats Command Enhancement ✅
Co-occurring Label Breakdown: When filtering stats by specific labels, the command now shows a breakdown of other labels that appeared alongside the filter labels.
Example Use Case:
Output Shows:
nytid: 3h (2h + 1h = time when nytid appeared with devel)canvaslms: 1.5h (time when canvaslms appeared with devel)testing: 1h (time when testing appeared with devel)This shows how development time was distributed across different projects, answering questions like "How much of my development time was spent on nytid vs canvaslms?"
Implementation Details
Stats Command Logic:
Benefits:
Comprehensive Testing ✅
Added Two New Test Suites:
test_stats_co_occurring_labels(): Tests the new co-occurring label functionalitytest_all_tracking_module_functions(): Comprehensive integration test covering all commandsTest Coverage:
All Features Working ✅
Complete feature set with enhanced testing:
Fixes #21.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.