socialforge/app/helpers/syllabuses_helper.rb

39 lines
743 B
Ruby
Raw Normal View History

2016-06-14 10:38:11 +08:00
module SyllabusesHelper
def get_syllabuses_by_tag(tag_name)
Syllabus.tagged_with(tag_name).order('updated_at desc')
end
def teacher_count syllabus
count = 0
courses = syllabus.courses
unless courses.empty?
courses.each do |c|
count += TeacherAndAssistantCount c
end
end
count
end
def student_count syllabus
count = 0
courses = syllabus.courses
unless courses.empty?
courses.each do |c|
count += studentCount c
end
end
count
end
def file_count syllabus
count = 0
courses = syllabus.courses
unless courses.empty?
courses.each do |c|
count += visable_attachemnts_incourse(c).count
end
end
count
end
2016-06-14 10:38:11 +08:00
end