app/views/educode_sales/activities/index.json.jbuilder in educode_sales-0.9.62 vs app/views/educode_sales/activities/index.json.jbuilder in educode_sales-0.9.63
- old
+ new
@@ -1,6 +1,7 @@
teachers_count = 0
+schools_count = 0
json.data do
json.array! @activities do |d|
json.id d.id
json.name d.name
json.days d.days
@@ -13,13 +14,17 @@
json.clazz_id d.clazz_id
json.staff d.staff&.user&.real_name
json.staff_manage d.manages.map { |d| d.staff.user.real_name}.uniq.join("、")
json.staff_assist d.assists.map { |d| d.staff.user.real_name}.uniq.join("、")
json.expert d.experts.pluck(:name).join("、")
+
+ json.schools_count EducodeSales::ActivityTeacher.joins(teacher: :department).where(activity_id: d.id).select("distinct(school_id)").count
+ schools_count += EducodeSales::ActivityTeacher.joins(teacher: :department).where(activity_id: d.id).select("distinct(school_id)").count
end
end
json.totalRow do
json.teachers_count teachers_count.to_s
+ json.schools_count schools_count.to_s
end
json.code 0
json.count @activities.total_count
\ No newline at end of file