Skip to content
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

Added function to edit start/end time of entry. #4

Closed
wants to merge 2 commits into from

Conversation

akoppela
Copy link
Contributor

@akoppela akoppela commented Sep 9, 2019

Fixes #1.

@xendk
Copy link
Owner

xendk commented Sep 9, 2019

Looks good.

The documentation gives the impression that whether to use time span or durations is dictated by the (company) account settings, and it would seem so.

If I inspect reaper-timeentries for todays entries, I apparently don't get any start or end times:

  (:id . 1077904344)
  (:project_id . 308078)
  (:project . "Internal affairs")
  (:task_id . 271967)
  (:task . "Andet")
  (:is_running)
  (:hours . 1.27)
  (:started_time)
  (:ended_time)
  (:notes . "morgenstatus"))

Editing an entry using timespans doesn't work, it stays at the same duration. Can you confirm the reverse case is true for you? I hope it is, then we can rename reaper-edit-entry-time to reaper-edit-entry-duration-time and create a new reaper-edit-entry-time which simply calls one or the other depending on whether start-time is defined (I assume that Harvest still provides a calculated hours, as the display functions rely on it in order to be able to show anything).

I would have liked some validation on the time strings before passing them to Harvest, but I can see I forgot myself in reaper-edit-entry-time.

@akoppela
Copy link
Contributor Author

akoppela commented Sep 9, 2019

I can confirm that in duration mode I can not edit start/end time and in timespan mode I can not edit duration.

@akoppela
Copy link
Contributor Author

akoppela commented Sep 9, 2019

I've added custom variable now and updated the function accordingly.

@akoppela
Copy link
Contributor Author

akoppela commented Sep 9, 2019

Validation on the time string is a nice addition. I can look into it.

@xendk
Copy link
Owner

xendk commented Sep 10, 2019

Nice.

Actually, we don't need the custom variable, we can just check if the edited time entry has a start time.

@akoppela
Copy link
Contributor Author

Actually, we don't need the custom variable, we can just check if the edited time entry has a start time.

Is that documented behavior? If not then it's not a reliable solution because stated_in is a property of time entry object.

@xendk
Copy link
Owner

xendk commented Sep 10, 2019

Is that documented behavior?

Somewhat:

started_time: Time the time entry was started (if tracking by start/end times).

If not then it's not a reliable solution because stated_in is a property of time entry object.

We've already established that editing an entry that doesn't have a started_time simply doesn't work, so I'd call it reliable enough.

@akoppela
Copy link
Contributor Author

Indeed there is a way to know if a Harvest expects duration based time tracking or not.

Create a time entry via duration⚭
Creates a new time entry object. Returns a time entry object and a 201 Created response code if the call succeeded.
You should only use this method to create time entries when your account is configured to track time via duration. You can verify this by visiting the Settings page in your Harvest account or by checking if wants_timestamp_timers is false in the Company API.

I checked and i'm able to request company settings with my API key. Could you please verify that it works for you as well?

@xendk
Copy link
Owner

xendk commented Sep 11, 2019

It does, but the documentation also clearly states that started_time is only set if the entry is a start/end time entry, so I really don't see the need for another API call.

@akoppela
Copy link
Contributor Author

I see. I agree here. The documentation also says that timer_started_at is available only when time is tracked based on duration. Do you think it's nicer to use timer_started_at instead of started_time?

@xendk
Copy link
Owner

xendk commented Sep 11, 2019

I prefer started_time as we're actually using that value. That got a nice feel to it.

@akoppela
Copy link
Contributor Author

Ok. Make sense.

@xendk
Copy link
Owner

xendk commented Nov 14, 2020

Does this still work for you?

I guess reaper--list-format should be adjusted in duration mode too.

@akoppela akoppela force-pushed the edit-start-end-time branch from 039168a to 5955910 Compare January 8, 2022 13:18
@akoppela akoppela closed this Jan 8, 2022
@akoppela akoppela deleted the edit-start-end-time branch January 8, 2022 13:19
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.

Add option to edit time based on start and end time.
2 participants