Fixed UTC issue.
This commit is contained in:
parent
a702e39730
commit
3462ad9aa0
3 changed files with 8 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
require 'time_calculation'
|
||||||
class Ticket < ApplicationModel
|
class Ticket < ApplicationModel
|
||||||
before_create :number_generate, :check_defaults
|
before_create :number_generate, :check_defaults
|
||||||
before_update :check_defaults
|
before_update :check_defaults
|
||||||
|
|
|
@ -54,7 +54,6 @@ class Time
|
||||||
end
|
end
|
||||||
|
|
||||||
while !Time.workday?(next_business_time)
|
while !Time.workday?(next_business_time)
|
||||||
puts '4'
|
|
||||||
next_business_time += 1.day
|
next_business_time += 1.day
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ class Time
|
||||||
result += time_b - Time.parse(time_b.strftime('%Y-%m-%d ') + BusinessTime::Config.beginning_of_workday) # Last day
|
result += time_b - Time.parse(time_b.strftime('%Y-%m-%d ') + BusinessTime::Config.beginning_of_workday) # Last day
|
||||||
|
|
||||||
# All days in between
|
# All days in between
|
||||||
puts "--- #{time_a}-#{time_b} - #{direction}"
|
#puts "--- #{time_a}-#{time_b} - #{direction}"
|
||||||
|
|
||||||
# duration_of_working_day = Time.parse(BusinessTime::Config.end_of_workday) - Time.parse(BusinessTime::Config.beginning_of_workday)
|
# duration_of_working_day = Time.parse(BusinessTime::Config.end_of_workday) - Time.parse(BusinessTime::Config.beginning_of_workday)
|
||||||
# result += (time_a.to_date.business_days_until(time_b.to_date) - 1) * duration_of_working_day
|
# result += (time_a.to_date.business_days_until(time_b.to_date) - 1) * duration_of_working_day
|
||||||
|
@ -107,7 +106,7 @@ puts "--- #{time_a}-#{time_b} - #{direction}"
|
||||||
end_of_workday = Time.end_of_workday(time_c)
|
end_of_workday = Time.end_of_workday(time_c)
|
||||||
if !Time.workday?(time_c)
|
if !Time.workday?(time_c)
|
||||||
time_c = Time.beginning_of_workday(time_c) + 1.day
|
time_c = Time.beginning_of_workday(time_c) + 1.day
|
||||||
puts 'VACATIONS! ' + time_c.to_s
|
# puts 'VACATIONS! ' + time_c.to_s
|
||||||
end
|
end
|
||||||
if time_c.to_date == time_b.to_date
|
if time_c.to_date == time_b.to_date
|
||||||
if end_of_workday < time_b
|
if end_of_workday < time_b
|
||||||
|
|
|
@ -32,7 +32,11 @@ module TimeCalculation
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.dest_time(start_time, diff_in_min)
|
def self.dest_time(start_time, diff_in_min)
|
||||||
start_time = Time.parse( start_time.to_s + 'UTC' )
|
start_time_string = start_time.to_s
|
||||||
|
if start_time.to_s != /UTC/
|
||||||
|
start_time_string += ' UTC'
|
||||||
|
end
|
||||||
|
start_time = Time.parse( start_time_string )
|
||||||
dest_time = diff_in_min.round.business_minute.after( start_time )
|
dest_time = diff_in_min.round.business_minute.after( start_time )
|
||||||
return dest_time
|
return dest_time
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue