You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/subjects/school_report.json.jbuilder

9 lines
589 B

6 years ago
json.schools @schools.each do |school|
pass_count = Myshixun.find_by_sql("select count(ms.id) ms_count from myshixuns ms, user_extensions ue where ue.school_id =
#{school.id} and ms.user_id = ue.user_id and ms.status = 1 and shixun_id in
(select shixun_id from stage_shixuns where subject_id = '#{@subject.id}')").first.try(:ms_count).to_i
json.name school.school_name
json.student_count school.ue_count
json.pass_count pass_count
json.unpass_count school.ue_count - pass_count
end