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

linting

ulferts40c880fd6542
diff --git a/app/models/query/timelines.rb b/app/models/query/timelines.rb
index 052dbcb6e1c..480e67c2ed0 100644
--- a/app/models/query/timelines.rb
+++ b/app/models/query/timelines.rb
@@ -32,16 +32,16 @@ module Query::Timelines
extend ActiveSupport::Concern
included do
- enum timeline_zoom_level: %i(days weeks months quarters years auto)
+ enum timeline_zoom_level: { days: 0, weeks: 1, months: 2, quarters: 3, years: 4, auto: 5 }
validates :timeline_zoom_level, inclusion: { in: timeline_zoom_levels.keys }
serialize :timeline_labels, Hash
validate :valid_timeline_labels
def valid_timeline_labels
- return unless timeline_labels.present?
+ return if timeline_labels.blank?
- valid_keys = %w(farRight left right) == timeline_labels.keys.map(&:to_s).sort
+ valid_keys = timeline_labels.keys.map(&:to_s).sort == %w(farRight left right)
errors.add :timeline_labels, :invalid unless valid_keys
end
end