update multiple if to case when for sum_array.rb