Advertisement
donnykurnia

Untitled

Mar 29th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   def outlet_coverages
  2.     d = []
  3.     Store.by_customer_and_city(params[:customer_id],params[:city_id],params[:data_date])
  4.          .each do |x|
  5.            percent_num = (x.average_score.floor.to_s.size > 1) ? x.average_score.floor.to_s[0]+'0' : "10"
  6.            d << {
  7.              latLng:  [x.latitude.to_f, x.longitude.to_f],
  8.              data:    "<b>#{x.name_store}</b><br>#{x.address}<br>percentage: #{x.average_score}%",
  9.              city_id: x.city_id,
  10.              tag:     ['marker',
  11.                        x.city.code,
  12.                        Customer.by_store(x.id).code,
  13.                        Area.by_store(x.id).code
  14.                       ],
  15.              options: { icon: asset_path("percentages/21px-#{percent_num}p.png") }
  16.            }
  17.          end
  18.     render json: d
  19.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement