|
@@ -236,6 +236,8 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
|
|
start_time = Time.parse( start_time.to_s + ' UTC' )
|
|
|
end
|
|
|
|
|
|
+ return start_time if diff_in_min == 0
|
|
|
+
|
|
|
# if no config is given, just return calculation directly
|
|
|
if !config
|
|
|
return start_time + (diff_in_min * 60)
|
|
@@ -288,8 +290,12 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
|
|
# fillup to first full hour
|
|
|
if first_loop
|
|
|
|
|
|
- # get rest of this hour
|
|
|
- diff = 3600 - (start_time - start_time.beginning_of_hour)
|
|
|
+ # get rest of this hour if diff_in_min in lower the one hour
|
|
|
+ diff_to_count = 3600
|
|
|
+ if diff_to_count > (diff_in_min * 60)
|
|
|
+ diff_to_count = diff_in_min * 60
|
|
|
+ end
|
|
|
+ diff = diff_to_count - (start_time - start_time.beginning_of_hour)
|
|
|
start_time += diff
|
|
|
|
|
|
# check if it's countable hour
|
|
@@ -318,6 +324,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
|
|
|
|
|
# check if it's business hour and count
|
|
|
if working_hours[ week_day_map[week_day] ][ next_hour ]
|
|
|
+
|
|
|
# check if count is within this hour
|
|
|
if count > 59 * 60
|
|
|
diff = 3600
|