This commit is contained in:
BoHung Chiu 2021-07-26 19:31:11 +08:00
parent 352cd5cbbc
commit c8a3d29a23
1 changed files with 10 additions and 1 deletions

View File

@ -136,6 +136,15 @@ class RulingTimerTemp
end end
return last_work_time return last_work_time
end end
def get_first_work_time
first_work_time = self.work_times.first
if first_work_time.nil?
first_work_time = DateTime.now.utc.new_offset(self.time_offset)
else
first_work_time = convert_datetime(first_work_time).new_offset(self.time_offset)
end
return first_work_time
end
def check_and_store def check_and_store
unless self.new_record? unless self.new_record?
time_now = DateTime.now.utc time_now = DateTime.now.utc
@ -321,7 +330,7 @@ class RulingTimerTemp
end end
ruling_timer_history.send("#{field_name}=",self.send(field_name)) ruling_timer_history.send("#{field_name}=",self.send(field_name))
end end
ruling_timer_history.date = self.get_last_work_time.new_offset(self.time_offset).strftime("%Y/%m/%d %w") ruling_timer_history.date = self.get_first_work_time.new_offset(self.time_offset).strftime("%Y/%m/%d %w")
ruling_timer_history.user = self.user ruling_timer_history.user = self.user
ruling_timer_history.save ruling_timer_history.save
end end