Handle nil value
This commit is contained in:
parent
9930665156
commit
ed85b96f4d
|
@ -65,6 +65,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def rating_label_color(rating)
|
def rating_label_color(rating)
|
||||||
|
return nil if rating.nil?
|
||||||
case rating.round
|
case rating.round
|
||||||
when (0...3) then 'primary'
|
when (0...3) then 'primary'
|
||||||
when 3 then 'danger'
|
when 3 then 'danger'
|
||||||
|
@ -75,6 +76,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def human_rating(rating)
|
def human_rating(rating)
|
||||||
|
return nil if rating.nil?
|
||||||
case rating.round
|
case rating.round
|
||||||
when (0...3) then t('ratings.poor')
|
when (0...3) then t('ratings.poor')
|
||||||
when 3 then t('ratings.average')
|
when 3 then t('ratings.average')
|
||||||
|
|
Loading…
Reference in New Issue