Sha256: 151acbbf3095c650c41d675b16ed4fb5eaabec81b13ccfe720f763a4dda707ce

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

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_id ? 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]
    # a_id = EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).present? ? EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).attitude_id : 73
    # json.attitude EducodeSales::TeacherFollow.find_by(teacher_id: d.id).present? ? EducodeSales::Common.find(EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).attitude_id).name : ''
    json.attitude d.follow_up&.attitude&.name
    json.courses_count d.user_id ? Course.joins(:course_members).where(course_members: {user_id: d.user_id}).distinct("course_id").count : 0
    json.actives d.actives
    json.students d.students_count
    json.regist_at d.user.present? ? d.user.created_on.to_s(:date) : ''
    json.teacher_used d.teacher_used_of_department
  end
end
json.code 0
json.count @teachers.total_count

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
educode_sales-0.4.0 app/views/educode_sales/teachers/index.json.jbuilder