Open teddywing opened 6 years ago
Huh, just realised this doesn't actually work correctly. I had been testing with 'yesterday', but that was just a fluke because the stop
command handles both today and yesterday (https://github.com/zenhob/hcl/blob/cea2bbe0d1b2c9629d7fab397093856580a9e099/lib/hcl/commands.rb#L127).
Assuming I need to get DayEntry.with_timer
to use the provided date in order to get this to work correctly.
Came up with a new mechanism for doing logging and handling past dates. This duplicates the work of Commands#start
while introducing a way to parse a date as an optional first argument, and instead of calling task.start
, it calls task.add
. This enables the time to be logged on the specified date without ever having to deal with stopping timers.
With this latest change, I've duplicated most of the contents of Commands#start
, and haven't figured out a good strategy to eliminate that duplication. If that's a concern, I'd appreciate any ideas to simplify the code.
Adds an optional date argument to the
log
command that can be specified just before the task alias.Some examples from @skoppelmanCC:
command_test.rb(#test_start): Update expected method call arguments with
spent_at
. Now that we're passing inspent_at
, the expected arguments should include it.utility_test.rb: Add tests for
#get_date
Fixes #83.