Fix day lag

Signed-off-by: Sergey Bogdanov <sergey.bogdanov@oktetlabs.ru>
master
Sergey Bogdanov 2022-01-17 12:07:54 +00:00
parent 228a170065
commit 3a172adb84
1 changed files with 6 additions and 1 deletions

View File

@ -64,6 +64,8 @@ class DbTime
@time.to_time.localtime.strftime("%Y-%m-%d %H:%M:%S")
elsif @time.is_a? DateTime and @time.mjd > 0
@time.new_offset(@@offset).strftime("%Y-%m-%d %H:%M:%S")
elsif @time.class == Time
@time.to_time.localtime.strftime("%Y-%m-%d %H:%M:%S")
else
"<N/A>"
end
@ -135,7 +137,10 @@ class DiaryPerson
@records += 1
# We assume that 20:00 is the rough time people submit the diary
@lag += (created - (ddate + Rational(20, 24)))
tlag = (created -((Time.strptime(ddate.to_s + " 00:00:00", "%Y-%m-%d %H:%M:%S")) + 20*60*60))/60/60/24
if tlag > 0
@lag += tlag
end
week_day_name = Date::ABBR_DAYNAMES[ddate.wday]
@week[week_day_name][:hours] += hours.to_i