@sames=[]
diffs_by_rule.values.sort.each do |diff|
case diff.status
- when DIFF_IN1: @in1<<diff
- when DIFF_IN2: @in2<<diff
- when DIFF_MODIFIED: @modified<<diff
- when DIFF_SAME: @sames<<diff
+ when DIFF_IN1 then @in1<<diff
+ when DIFF_IN2 then @in2<<diff
+ when DIFF_MODIFIED then @modified<<diff
+ when DIFF_SAME then @sames<<diff
end
end
end
def role_name(role)
case(role.to_s)
- when 'admin': 'Administrators'
- when 'default-admin': 'Administrators'
- when 'user': 'Users'
- when 'default-user': 'Users'
- when 'codeviewer': 'Code viewers'
- when 'default-codeviewer': 'Code viewers'
+ when 'admin' then 'Administrators'
+ when 'default-admin' then 'Administrators'
+ when 'user' then 'Users'
+ when 'default-user' then 'Users'
+ when 'codeviewer' then 'Code viewers'
+ when 'default-codeviewer' then 'Code viewers'
else role.to_s
end
end
else
if (options[:check_alert_status]||true) && !measure.alert_status.blank?
case(measure.alert_status)
- when Metric::TYPE_LEVEL_OK : percent=100.0
- when Metric::TYPE_LEVEL_ERROR : percent=0.0
- when Metric::TYPE_LEVEL_WARN : percent=50.0
+ when Metric::TYPE_LEVEL_OK then percent=100.0
+ when Metric::TYPE_LEVEL_ERROR then percent=0.0
+ when Metric::TYPE_LEVEL_WARN then percent=50.0
end
elsif measure.metric.value_type==Metric::VALUE_TYPE_LEVEL
case(measure.text_value)
- when Metric::TYPE_LEVEL_OK : percent=100.0
- when Metric::TYPE_LEVEL_WARN : percent=50.0
- when Metric::TYPE_LEVEL_ERROR : percent=0.0
+ when Metric::TYPE_LEVEL_OK then percent=100.0
+ when Metric::TYPE_LEVEL_WARN then percent=50.0
+ when Metric::TYPE_LEVEL_ERROR then percent=0.0
end
elsif measure.value && max_value && min_value
percent = value_to_percent(measure.value, min_value, max_value)