From b0db7dfece135a97d374872ec185a0793703e801 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 26 Nov 2014 17:38:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E6=98=AF=E5=90=A6=E4=B8=BA=E5=BD=93=E5=89=8D=E5=AD=A6?= =?UTF-8?q?=E6=9C=9F=E6=88=96=E4=B8=8B=E4=B8=80=E5=AD=A6=E6=9C=9F=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 14 ++++++++++++++ app/helpers/files_helper.rb | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 178782da3..04b5ad89d 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -486,6 +486,20 @@ module CoursesHelper term end + def course_in_current_or_next_term course + is_current_term = false + is_next_term = false + if course.time == Time.now.year && course.term == cur_course_term + is_current_term = true + end + if cur_course_term == "秋季学期" && course.time == (Time.now.year + 1) && course.term == "春季学期" + is_next_term = true + elsif cur_course_term == "春季学期" && course.time == Time.now.year && course.term == "秋季学期" + is_next_term = true + end + is_current_term || is_next_term + end + #获取课程动态 def get_course_activity courses, activities @course_ids=activities.keys() diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index f3be6e904..d51606d90 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -47,7 +47,7 @@ module FilesHelper def courses_check_box_tags(name,courses,current_course,attachment) s = '' courses.each do |course| - if !(attachment.container_type && attachment.container_id == course.id) && is_course_teacher(User.current,course) + if !(attachment.container_type && attachment.container_id == course.id) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course) s << " [#{get_course_term course}]
" end end