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
Fixes Performance/CompareWithBlock offenses
Klaus Zanders58a4775f196e
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rbindex 36d63627f47..e228d150970 100644--- a/app/controllers/repositories_controller.rb+++ b/app/controllers/repositories_controller.rb@@ -391,9 +391,7 @@ class RepositoriesController < ApplicationControllerdef graph_commits_per_author(repository)commits_by_author = Changeset.where(['repository_id = ?', repository.id]).group(:committer).size- commits_by_author.to_a.sort! do |x, y|- x.last <=> y.last- end+ commits_by_author.to_a.sort_by!(&:last)changes_by_author = Change.includes(:changeset).where(["#{Changeset.table_name}.repository_id = ?", repository.id])diff --git a/lib/open_project/scm/adapters/subversion.rb b/lib/open_project/scm/adapters/subversion.rbindex 486e18a7e5c..065eace0bfe 100644--- a/lib/open_project/scm/adapters/subversion.rb+++ b/lib/open_project/scm/adapters/subversion.rb@@ -166,7 +166,7 @@ module OpenProjectrevisions = Revisions.newfetch_revision_entries(identifier_from, identifier_to, options, path) do |logentry|paths = logentry.xpath('paths/path').map { |entry| build_path(entry) }- paths.sort! { |x, y| x[:path] <=> y[:path] }+ paths.sort_by! { |a| a[:path] }r = extract_revision(logentry)r.paths = pathsdiff --git a/lib/tasks/copyright_authors.rake b/lib/tasks/copyright_authors.rakeindex d7f7792c106..3ff0163eb7a 100644--- a/lib/tasks/copyright_authors.rake+++ b/lib/tasks/copyright_authors.rake@@ -57,7 +57,7 @@ namespace :copyright doauthors.each do |a|first, last = contributions.select { |c| c.author == a }- .minmax { |a, b| a.date <=> b.date }+ .minmax_by(&:date)contribution_periods << CONTRIBUTION_PERIOD.new(a, first.date.year, last.date.year)enddiff --git a/modules/reporting/app/models/cost_query.rb b/modules/reporting/app/models/cost_query.rbindex a5293d4acdb..c9a8089ed92 100644--- a/modules/reporting/app/models/cost_query.rb+++ b/modules/reporting/app/models/cost_query.rb@@ -87,7 +87,7 @@ class CostQuery < ApplicationRecorddef serialize# have to take the reverse group_bys to retain the original order when deserializing- self.serialized = { filters: (filters.map(&:serialize).reject(&:nil?).sort { |a, b| a.first <=> b.first }),+ self.serialized = { filters: (filters.map(&:serialize).reject(&:nil?).sort_by(&:first)),group_bys: group_bys.map(&:serialize).reject(&:nil?).reverse }end