Sha256: 0e77b71b148b6fbe0df51af051c21d40147b0204f001ed495047afa48131f9cb

Contents?: true

Size: 1.93 KB

Versions: 13

Compression:

Stored size: 1.93 KB

Contents

teacher_follows_count = 0
courses_counts = 0
json.data do
  json.array! @teachers do |d|
    json.id d.id
    json.name d.name
    json.department d.department&.name || ""
    json.school d.department&.school&.name || ""
    json.professional_title d.professional_title
    json.job d.job
    json.user_id d.user_id
    json.login d.user&.login || ''
    json.course_subjects_count d.course_subjects_count
    json.teacher_follows_count d.teacher_follows_count
    json.activities_count d.activity_teachers_count
    json.source EducodeSales::Common.teacher_source_name[d.source_id]
    json.attitude d.follow_up&.attitude&.name
    json.courses_count d.courses_count
    json.area d.department&.school&.province
    json.actives d.actives
    json.experience d['experience'] || 0
    json.grade d['grade'] || 0
    json.mobile d.user&.phone || ''
    json.students d.students_count
    json.followup_at d.follow_up&.created_at&.to_s
    json.latest_time (d['latest_time'] ? DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d['latest_time'].strftime("%Y-%m-%d")) : DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d.created_at.strftime("%Y-%m-%d"))).to_i

    json.staff_manage @staff_manages[d.department&.school&.province]&.join(",")

    json.follow_person d.follow_up&.staff&.user&.real_name || ''
    json.created_on d.user.present? ? d.user.created_on.to_s(:date) : ''
    json.last_login_on (d.user.present? && d.user.last_login_on.present?) ? d.user.last_login_on.to_s(:date) : ''
    json.teacher_used d.teacher_used
    json.wechat d.wechat
    json.created_at d.created_at.to_s(:date)
    json.teacher_assist d.teacher_assign_follows.map{|t| t.staff.user.real_name}.join(',')
    teacher_follows_count += d.teacher_follows_count
    courses_counts += d.courses_count
  end
end

json.totalRow do
  json.teacher_follows_count teacher_follows_count.to_s
  json.courses_count courses_counts.to_s
end
json.code 0
json.count @teachers.total_count

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
educode_sales-0.9.68 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.67 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.66 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.65 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.64 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.63 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.62 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.61 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.60 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.59 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.58 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.57 app/views/educode_sales/teachers/index.json.jbuilder
educode_sales-0.9.56 app/views/educode_sales/teachers/index.json.jbuilder