OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
exit early when no timezone is stored
Klaus Zandersb34f38464cfd
diff --git a/modules/costs/app/models/time_entry.rb b/modules/costs/app/models/time_entry.rbindex 659885a7d4e..b9e47e8d198 100644--- a/modules/costs/app/models/time_entry.rb+++ b/modules/costs/app/models/time_entry.rb@@ -123,12 +123,14 @@ class TimeEntry < ApplicationRecorddef start_timestampreturn nil if start_time.blank?+ return nil if time_zone.blank?ActiveSupport::TimeZone[time_zone].local(spent_on.year, spent_on.month, spent_on.day, start_time / 60, start_time % 60)enddef end_timestampreturn nil if end_time.blank?+ return nil if time_zone.blank?ActiveSupport::TimeZone[time_zone].local(spent_on.year, spent_on.month, spent_on.day, end_time / 60, end_time % 60)enddiff --git a/modules/costs/spec/models/time_entry_spec.rb b/modules/costs/spec/models/time_entry_spec.rbindex 1d14b1f2ee1..02afe96aa86 100644--- a/modules/costs/spec/models/time_entry_spec.rb+++ b/modules/costs/spec/models/time_entry_spec.rb@@ -500,6 +500,11 @@ RSpec.describe TimeEntry doexpect(time_entry.start_timestamp).to be_nilend+ it "returns nil if timezone is nil" do+ time_entry.time_zone = nil+ expect(time_entry.start_timestamp).to be_nil+ end+it "generates a proper timestamp from the stored information" dotime_entry.start_time = 14 * 60time_entry.spent_on = Date.new(2024, 12, 24)@@ -515,6 +520,11 @@ RSpec.describe TimeEntry doexpect(time_entry.end_timestamp).to be_nilend+ it "returns nil if timezone is nil" do+ time_entry.time_zone = nil+ expect(time_entry.end_timestamp).to be_nil+ end+it "generates a proper timestamp from the stored information" dotime_entry.end_time = 14 * 60time_entry.spent_on = Date.new(2024, 12, 24)