Updated hours calculation logic