Sha256: 3321d0c4a5053353f795f9f5d3125ccba90f1e3337aac6ed8b63134904ee3ba0
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id json.data do json.array! @customers do |d| business_ids = EducodeSales::Business.where(school_id: d.id).ids follow_ups = EducodeSales::FollowUp.where(business_id: business_ids) customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id) a_last_follow_time = follow_ups.last&.created_at&.to_s b_last_follow_time = customer_follows.last&.created_at&.to_s if a_last_follow_time.present? && b_last_follow_time.present? json.last_follow_time a_last_follow_time < b_last_follow_time ? b_last_follow_time : a_last_follow_time else json.last_follow_time a_last_follow_time || b_last_follow_time end json.id d.id json.name d.name json.area d.province school_property = d.school_property property = [] if school_property.present? # property << '985工程' if school_property.project_985 # property << '211工程' if school_property.project_211 property << '本科院校' if school_property.regular_college property << '大专院校' if school_property.junior_college property << '中专学校' if school_property.secondary_school property << '军事院校' if school_property.military_school property << '企业' if school_property.enterprise property << '小学' if school_property.ele_school property << '中学' if school_property.mid_school property << '其他' if school_property.other end json.property property.join("、") json.department d.departments.size json.business EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_businesses.school_id = ?", d.id).size json.follow follow_ups.size + customer_follows.size json.staff EducodeSales::CustomerExtension.find_by(school_id: d.id)&.customer_staff&.user&.real_name end end json.code 0 json.count @customers.total_count
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
educode_sales-0.9.43 | app/views/educode_sales/customers/index.json.jbuilder |