Move default value into else branch and remove superfluous variable

This commit is contained in:
Björn Geuken 2015-04-17 15:33:57 +02:00
parent 751bf4eb42
commit 9f3da955f0

View file

@ -167,23 +167,22 @@ class Event < ActiveRecord::Base
end end
def self.get_state_color(state) def self.get_state_color(state)
# default azure
result = '#00FFFF'
case state case state
when 'new' # blue when 'new' # blue
result = '#0000FF' '#0000FF'
when 'withdrawn' # orange when 'withdrawn' # orange
result = '#FF8000' '#FF8000'
when 'confirmed' # green when 'confirmed' # green
result = '#00FF00' '#00FF00'
when 'unconfirmed' # yellow when 'unconfirmed' # yellow
result = '#FFFF00' '#FFFF00'
when 'rejected' # red when 'rejected' # red
result = '#FF0000' '#FF0000'
when 'canceled' # grey when 'canceled' # grey
result = '#848484' '#848484'
else
'#00FFFF' # azure
end end
result
end end
def update_state(transition, mail = false, subject = false, send_mail = false, send_mail_param) def update_state(transition, mail = false, subject = false, send_mail = false, send_mail_param)