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

fixed the time logic #7

Merged
merged 1 commit into from
Aug 26, 2020
Merged

fixed the time logic #7

merged 1 commit into from
Aug 26, 2020

Conversation

DiegoOTdC
Copy link
Collaborator

Problem
The start and finish hours/minutes/seconds were being subtracted from each other.
"finishSeconds - startSeconds"
And then I combined that into a string again and send it to the backend.
This would create times like 00:10:-40
Which is not what we want for obvious reasons.

Solution
I split up the time strings in start and finish and turn each string number into an integer.
Then I turn all numbers into seconds and add those together.
So 10 hours will become 10h * 3600s = 36000 seconds.. etc.

After that I can subtract one from the other and use calculations to turn the time that was used back into hours, minutes and seconds.
Which are then send to the backend, together with the rest again.

Copy link
Collaborator

@DarianRushworth DarianRushworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, I understand it and very very well done. Now just to test it. enjoy the rest of your day you deserve it

Copy link
Collaborator

@StephBerg86 StephBerg86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great solution!

@DiegoOTdC DiegoOTdC merged commit c5e520d into development Aug 26, 2020
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.

3 participants