Sha256: d47e8db2f85392f18b14f2bb957e225492ad32c00e057037978671030b45f04c

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

json.data do
  json.array! @businesses do |d|
    json.id d.id
    json.name d.name
    json.department d.department.name
    json.school d.department.school.name
    json.follow_ups_count d.follow_ups_count
    json.follow_up_id d.last_follow_up_id
    # json.teachers_count d.follow_ups.sum(:key_people_count)
    # json.teachers_count EducodeSales::FollowUp.order(created_at: :desc).find_by(business_id: d.id).present? ? EducodeSales::FollowUp.order(created_at: :desc).find_by(business_id: d.id).key_people_count : 0
    json.clazz d.last_follow_up&.clazz&.name
    json.stage d.last_follow_up&.stage&.name
    json.invitation_at d.last_follow_up&.invitation_at.to_s
    json.reception_at d.last_follow_up&.reception_at.to_s
    json.total_amount d.last_follow_up&.total_amount
    json.return_money d.return_money
    json.place d.last_follow_up&.place&.name
    json.last_follow_person d.last_follow_up_id.present? ? EducodeSales::Staff.find(EducodeSales::Business.find_by(last_follow_up_id: d.last_follow_up_id).staff_id).user.real_name : ''
  end
end
json.code 0
json.count @businesses.total_count
json.msg 'succcess'

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
educode_sales-0.2.8 app/views/educode_sales/businesses/index.json.jbuilder
educode_sales-0.2.7 app/views/educode_sales/businesses/index.json.jbuilder
educode_sales-0.2.6 app/views/educode_sales/businesses/index.json.jbuilder
educode_sales-0.2.5 app/views/educode_sales/businesses/index.json.jbuilder
educode_sales-0.2.4 app/views/educode_sales/businesses/index.json.jbuilder
educode_sales-0.2.3 app/views/educode_sales/businesses/index.json.jbuilder
educode_sales-0.2.2 app/views/educode_sales/businesses/index.json.jbuilder
educode_sales-0.2.1 app/views/educode_sales/businesses/index.json.jbuilder