Ticket #1075: Accounting for allotted break time in estimated time to leave #1083
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue
Closes #1075
Context / Background
What change is being introduced by this PR?
I approached this problem by first looking at the translation pages and searching "Based on the time you arrived today, you should leave by". From there, I found where the leave-by translation was used and what function was associated with calculating this time estimate.
If the break has not yet been taken, I'm converting the hours and minutes set for working hours and break intervals into number type, then adding them together to calculate the total amount of time, before then converting them back into a time string.
If the break has been taken, I am using the old code to only factor in working hours per day for the estimated time to leave.
I am using values.length to determine whether the break has been taken, so this requires values.length to stay an array. In addition, the break interval is factored into to the estimated leave time from the very start of the day. The only way that this will change is if a shorter or longer than expected break is taken by the user.
How will this be tested?
I tested my code manually by changing the break interval and working hours in my user settings. Below are the results:
Before any break is taken, based on an 8 hour work day
After a longer than expected break, based on an 8 hour work day
After a shorter than expected break, based on a 7 hour and 15 minute work day