-
Notifications
You must be signed in to change notification settings - Fork 45
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
hcl resume should be idempotent #68
Comments
Good catch! Here is the offending line, for future reference: https://github.com/zenhob/hcl/blob/master/lib/hcl/commands.rb#L174 |
Um I think https://github.com/zenhob/hcl/blob/master/lib/hcl/commands.rb#L130 |
I have some time coming up to work on |
So it turns out that this is a limitation of the underlying timesheet API provided by Harvest. Instead of attempting to work around this (or change APIs, which is a larger scope than I wish to tackle), I plan to deprecate I'll plan to roll out a minor release with the new command and optional deprecation of the old commands, with a longer term plan to release a version with mandatory deprecation, concluding with the removal the deprecated commands for version 1.0 (if that ever happens) |
Will there still be a way to stop the current timer that doesn't require knowing which timer is running and won't start a timer if there's nothing running? |
this is a great question! it turns out that the |
Okay, coming around to trying this out today and it doesn't actually solve my problem. It gives a better name to resume, but it still fails to give me an idempotent resume timer. I want to be able to call If I use toggle, the second call will stop it. What I want is just like toggle, but it won't stop: def resume *args
ident = get_ident args
entry = if ident
task_ids = get_task_ids ident, args
DayEntry.last_by_task http, *task_ids
else
DayEntry.last(http)
end
if entry
unless entry.running?
"Starting #{entry} (at #{current_time})"
entry.toggle http
end
else
fail "No timer found."
end
end As it is now, I have to call stop and then call toggle and the harvest api isn't exactly fast, so reducing the calls would be great. |
Progress!
Charney Kaye
…On Thu, Jun 25, 2020 at 1:24 PM Aaron Jensen ***@***.***> wrote:
Okay, coming around to trying this out today and it doesn't actually solve
my problem. It gives a better name to resume, but it still fails to give me
an idempotent resume timer.
I want to be able to call hcl XXX 1234 5678 twice in a row and have the
result be that timer 1234 5678 is started once.
If I use toggle, the second call will stop it.
What I want is just like toggle, but it won't stop:
def resume *args
ident = get_ident args
entry = if ident
task_ids = get_task_ids ident, args
DayEntry.last_by_task http, *task_ids
else
DayEntry.last(http)
end
if entry
unless entry.running?
"Starting #{entry} (at #{current_time})"
entry.toggle http
end
else
fail "No timer found."
end
end
As it is now, I have to call stop and then call toggle and the harvest api
isn't exactly fast, so reducing the calls would be great.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBP5BGSGF26BW7U3FYFI63RYOW7LANCNFSM4BIGONJQ>
.
|
currently if i send resume for one task twice in a row it will start the timer and then stop it. Resume does not imply toggle.
The text was updated successfully, but these errors were encountered: