2016-06-14 10:38:11 +08:00
|
|
|
module SyllabusesHelper
|
2016-06-28 15:13:04 +08:00
|
|
|
def get_syllabuses_by_tag(tag_name)
|
|
|
|
Syllabus.tagged_with(tag_name).order('updated_at desc')
|
|
|
|
end
|
2016-06-30 10:44:11 +08:00
|
|
|
|
|
|
|
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
|