From: Go MAEDA Date: Mon, 2 Jan 2023 06:10:53 +0000 (+0000) Subject: Fix RuboCop offense Style/MinMaxComparison (#36919). X-Git-Tag: 5.1.0~309 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=21ca0e3d0a87f688a641466f27cccc79c64e4d6d;p=redmine.git Fix RuboCop offense Style/MinMaxComparison (#36919). git-svn-id: https://svn.redmine.org/redmine/trunk@22019 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 029db10f2..98fe05309 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -339,7 +339,7 @@ module IssuesHelper end def size - @left.size > @right.size ? @left.size : @right.size + [@left.size, @right.size].max end def to_html diff --git a/lib/redmine/export/pdf/issues_pdf_helper.rb b/lib/redmine/export/pdf/issues_pdf_helper.rb index 80c306a0e..6b3cbb1cf 100644 --- a/lib/redmine/export/pdf/issues_pdf_helper.rb +++ b/lib/redmine/export/pdf/issues_pdf_helper.rb @@ -60,7 +60,7 @@ module Redmine right << [l(:field_estimated_hours), l_hours(issue.estimated_hours)] unless issue.disabled_core_fields.include?('estimated_hours') right << [l(:label_spent_time), l_hours(issue.total_spent_hours)] if User.current.allowed_to?(:view_time_entries, issue.project) - rows = left.size > right.size ? left.size : right.size + rows = [left.size, right.size].max left << nil while left.size < rows right << nil while right.size < rows @@ -82,7 +82,7 @@ module Redmine border_last = 'R' end - rows = left.size > right.size ? left.size : right.size + rows = [left.size, right.size].max rows.times do |i| heights = [] pdf.SetFontStyle('B', 9) diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index ade37a33e..448d3190e 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -117,7 +117,7 @@ module Redmine return @number_of_rows if @number_of_rows rows = projects.inject(0) {|total, p| total += number_of_rows_on_project(p)} - rows > @max_rows ? @max_rows : rows + [rows, @max_rows].min end # Returns the number of rows that will be used to list a project on diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index 42c15d65e..d9d889201 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -77,7 +77,7 @@ module Redmine def last_item l = first_item + per_page - 1 - l > item_count ? item_count : l + [l, item_count].min end def linked_pages