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.
16 lines
533 B
16 lines
533 B
module SchoolHelper
|
|
def schoolMember_num school
|
|
count = UserExtensions.where("school_id = #{school.id} or occupation = '#{school.name}'").count
|
|
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
|