app/views/educode_sales/teachers/index.json.jbuilder in educode_sales-0.4.4 vs app/views/educode_sales/teachers/index.json.jbuilder in educode_sales-0.4.5

- old
+ new

@@ -1,5 +1,7 @@ +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 @@ -11,14 +13,22 @@ 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.user_id ? Course.joins(:course_members).where(course_members: {user_id: d.user_id}).where("is_delete = 0 and role != 4 and excellent = 0 and is_hidden = 0").where("start_date is null or start_date <= '#{Date.today}'").distinct(:course_id).count : 0 + json.courses_count d.courses_count 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 + json.teacher_used d.teacher_used + + 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 \ No newline at end of file