Sha256: de2f5828e7062500925868c7d9d657dfe08f7561daddf9e161e4916d3f5440f5

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

json.data do
  json.array! @staffs do |d|
    json.id d.id
    json.name d.user.real_name
    json.role d.role&.name
    json.area d.areas.present? ? d.areas.pluck(:name).join("、") : ''
    json.business_a d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @a_clazz&.id).count
    json.business_b d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @b_clazz&.id).count
    json.goal d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.stage_id in (?)", @step_ids).sum(:total_amount)
    json.return_money  d.businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").sum("educode_sales_follow_ups.return_money")
    json.a_clazz_id @a_clazz&.id
    json.b_clazz_id @b_clazz&.id
  end
end

json.code 0
json.count @staffs.total_count

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
educode_sales-0.2.0 app/views/educode_sales/sales/index.json.jbuilder
educode_sales-0.1.8 app/views/educode_sales/sales/index.json.jbuilder
educode_sales-0.1.7 app/views/educode_sales/sales/index.json.jbuilder
educode_sales-0.1.5 app/views/educode_sales/sales/index.json.jbuilder