]> source.dussan.org Git - redmine.git/commitdiff
Fix RuboCop offense Style/MinMaxComparison (#36919).
authorGo MAEDA <maeda@farend.jp>
Mon, 2 Jan 2023 06:10:53 +0000 (06:10 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 2 Jan 2023 06:10:53 +0000 (06:10 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22019 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/issues_helper.rb
lib/redmine/export/pdf/issues_pdf_helper.rb
lib/redmine/helpers/gantt.rb
lib/redmine/pagination.rb

index 029db10f20dfcfeff7b3239492aa22523ef93851..98fe053099c2436c09f922e998d352c912a66597 100644 (file)
@@ -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
index 80c306a0e91cf2b8c22a2c23e2246b53f97b4a08..6b3cbb1cf7db7bc2409c4040f5fee9da7c6afdf1 100644 (file)
@@ -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)
index ade37a33e37c9b0f0d5cff0871a3ab0babdc7c49..448d3190e2e417e8b0b00731f350995651d6412a 100644 (file)
@@ -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
index 42c15d65e91e472f8eb06aec9b87120296121663..d9d88920102f1e1a4037ff2f2a768e20f7c26020 100644 (file)
@@ -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