Browse Source

code cleanup: rubocop: fix Layout/SpaceBeforeSemicolon and Style/WhenThen in app/models/issue_query.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@18725 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.1.0
Toshi MARUYAMA 4 years ago
parent
commit
80f18dd89c
2 changed files with 6 additions and 13 deletions
  1. 0
    6
      .rubocop_todo.yml
  2. 6
    7
      app/models/issue_query.rb

+ 0
- 6
.rubocop_todo.yml View File

@@ -312,7 +312,6 @@ Layout/SpaceBeforeFirstArg:
# Cop supports --auto-correct.
Layout/SpaceBeforeSemicolon:
Exclude:
- 'app/models/issue_query.rb'
- 'app/models/user_preference.rb'
- 'config/initializers/10-patches.rb'

@@ -1460,11 +1459,6 @@ Style/VariableInterpolation:
Exclude:
- 'lib/redmine/configuration.rb'

# Cop supports --auto-correct.
Style/WhenThen:
Exclude:
- 'app/models/issue_query.rb'

# Cop supports --auto-correct.
Style/WhileUntilModifier:
Exclude:

+ 6
- 7
app/models/issue_query.rb View File

@@ -416,16 +416,15 @@ class IssueQuery < Query

def sql_for_spent_time_field(field, operator, value)
first, second = value.first.to_f, value.second.to_f

sql_op =
case operator
when "=", ">=", "<=" ; "#{operator} #{first}"
when "><" ; "BETWEEN #{first} AND #{second}"
when "*" ; "> 0"
when "!*" ; "= 0"
else ; return nil
when "=", ">=", "<=" then "#{operator} #{first}"
when "><" then "BETWEEN #{first} AND #{second}"
when "*" then "> 0"
when "!*" then "= 0"
else
return nil
end

"COALESCE((" +
"SELECT ROUND(CAST(SUM(hours) AS DECIMAL(30,3)), 2) " +
"FROM #{TimeEntry.table_name} " +

Loading…
Cancel
Save