Prior to this PR, the estimated time to leave did not account for the break interval set by the user. I've added that functionality in, while making sure not to extend the estimated time to leave after break, too.
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 ran all of the Jest tests. One of them, titled "emit RESIZE_MAIN_WINDOW", failed. This test has nothing to do with my code, but rather to do with the size of my app window when opened.
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
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