Hello Bubble Community,
I am building a time tracking feature in my application and need assistance with rounding the total hours worked in a specific manner. Here is what I need:
• If the difference between Clock out and Clock in is 1 hour and 29 minutes, the total hours should be rounded down to 1 hour.
• If the difference between Clock out and Clock in is 1 hour and 31 minutes, the total hours should be rounded up to 2 hours.
In summary, I want to round the total hours as follows:
• Anything less than or equal to 30 minutes should round down to the previous hour.
• Anything more than 30 minutes should round up to the next hour.
How can I achieve this in Bubble? I joined my current setup ( i tried rounded to 0 but it doesn’t work).
Any guidance or example workflows on how to implement this in Bubble would be greatly appreciated!
Paychex is one of the largest payroll/employee tracker companies in the United States and does not round.
Rather they do it based on the fraction of the hour.
Ex: user clocks in at 9am and clocks out at 5pm
(No lunch just for ease). That’s 8 hours.
But if they clock out out at 5:19 that’s 8.31 hours
Whole hours+(minutes/60)=time worked.
I would personally model them. If you absolutely need to round up or down then I’d recommend using the same formula above then using :rounded down to 1
This would result in if it’s .5 or over it’ll round to 9 and if .49 or under it’ll round to 8. Accomplishing what you wanted without conditionals.
It’s not really for counting employee hours but for counting shooting hours. It’s an application for managing film studios. The manager does not want to charge for small overtime, so we have set a rule: if the shoot exceeds by more than 30 minutes, then the hour is billed. If it exceeds by less than 30 minutes, then the hour is not billed.
My mistake, “Rounded to 0” works perfectly, I just miscalculated a result! So it’s indeed rounded to 0 to round down to the previous hour (if -30min) or up to the next hour (if +30min). Rounded to 1 gives results with a decimal point.