16 lines
487 B
Ruby
16 lines
487 B
Ruby
module SchoolHelper
|
|
def schoolMember_num school
|
|
count = student_num(school) + teacher_num(school)
|
|
count.to_s
|
|
end
|
|
|
|
def student_num school
|
|
UserExtensions.find_by_sql("SELECT * FROM user_extensions WHERE occupation = '#{school.name}' AND identity = '1'").count
|
|
end
|
|
|
|
def teacher_num school
|
|
UserExtensions.find_by_sql("SELECT * FROM user_extensions AS ue, schools AS s WHERE ue.school_id = s.id AND s.name = '#{school.name}' AND ue.identity = '0'").count
|
|
end
|
|
|
|
end
|