Sha256: 5d421e89008709a7a0bce5f3d9fbcbe88a9558dedcc46dedab52bb9dd69f7360

Contents?: true

Size: 663 Bytes

Versions: 2

Compression:

Stored size: 663 Bytes

Contents

json.data do
  json.array! @places do |d|
    json.id d.id
    json.name d.name
    json.area_id d.areas.present? ? d.areas.pluck(:name).join("、") : ''
    json.businesses_count EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.place_id = #{d.id}").count
    json.amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum(:profit_amount)
    json.return_mount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.place_id = #{d.id}").sum(:return_money)
  end
end

json.code 0
json.count @places.size

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
educode_sales-0.1.4 app/views/educode_sales/places/index.json.jbuilder
educode_sales-0.1.3 app/views/educode_sales/places/index.json.jbuilder