diff --git a/diary.rb b/diary.rb index 83be077..80bcde4 100644 --- a/diary.rb +++ b/diary.rb @@ -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 "" 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