SHOW:
|
|
- or go back to the newest paste.
| 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" |
| 5 | + | percent_num = (x.average_score.floor.to_s.size > 1) ? x.average_score.floor.to_s[0]+'0' : "10" |
| 6 | - | d << {
|
| 6 | + | d << {
|
| 7 | - | latLng: [x.latitude.to_f, x.longitude.to_f], |
| 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}%",
|
| 8 | + | data: "<b>#{x.name_store}</b><br>#{x.address}<br>percentage: #{x.average_score}%",
|
| 9 | - | city_id: x.city_id, |
| 9 | + | city_id: x.city_id, |
| 10 | - | tag: ['marker', |
| 10 | + | tag: ['marker', |
| 11 | - | x.city.code, |
| 11 | + | x.city.code, |
| 12 | - | Customer.by_store(x.id).code, |
| 12 | + | Customer.by_store(x.id).code, |
| 13 | - | Area.by_store(x.id).code], |
| 13 | + | Area.by_store(x.id).code |
| 14 | - | options:{icon: request.base_url + "/assets/percentages/21px-#{percent_num}p.png" }
|
| 14 | + | ], |
| 15 | - | } |
| 15 | + | options: { icon: asset_path("percentages/21px-#{percent_num}p.png") }
|
| 16 | - | end |
| 16 | + | } |
| 17 | end | |
| 18 | render json: d | |
| 19 | end |