Skip to content

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

apply rubocop corrections

Sebastian Fiedlschuster0ee85722e8c6
diff --git a/app/models/query/timestamps.rb b/app/models/query/timestamps.rb
index 099a267db40..3c667479b14 100644
--- a/app/models/query/timestamps.rb
+++ b/app/models/query/timestamps.rb
@@ -42,15 +42,14 @@ module Query::Timestamps
# call `timestamp.to_time`.
#
def timestamps
- timestamps = super.collect { |timestamp_string|
+ timestamps = super.collect do |timestamp_string|
Timestamp.new(timestamp_string)
- }
- return timestamps.any? ? timestamps : [Timestamp.now]
+ end
+ timestamps.any? ? timestamps : [Timestamp.now]
end
def timestamps=(array)
super(array.collect { |element| element.respond_to?(:iso8601) ? element.iso8601 : element })
end
end
-
end
diff --git a/app/models/timestamp.rb b/app/models/timestamp.rb
index 611d598a039..c893f417ee6 100644
--- a/app/models/timestamp.rb
+++ b/app/models/timestamp.rb
@@ -14,10 +14,8 @@ class Timestamp
def self.parse(iso8601_string)
if iso8601_string.start_with? "P" # ISO8601 "Period"
ActiveSupport::Duration.parse(iso8601_string)
- else
- if Time.zone.parse(iso8601_string).blank?
- raise ArgumentError, "The string \"#{iso8601_string}\" cannot be parsed to a Time."
- end
+ elsif Time.zone.parse(iso8601_string).blank?
+ raise ArgumentError, "The string \"#{iso8601_string}\" cannot be parsed to a Time."
end
Timestamp.new(iso8601_string)
end