From abcf06ccc7cbd8e14713c7670247834c0ccd2f35 Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 19 Jan 2015 15:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E5=BC=95=E7=94=A8=E9=97=AE=E9=A2=98=E3=80=82=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=EF=BC=9A15=E5=B9=B41-3=E6=9C=88=E8=83=BD=E5=B1=9E?= =?UTF-8?q?=E4=BA=8E2014=E5=B9=B4=E7=A7=8B=E5=AD=A3=E5=AD=A6=E6=9C=9F?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=E5=8D=B4=E5=B0=86=E5=85=B6=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E4=B8=BA15=E5=B9=B4=E7=A7=8B=E5=AD=A3=E5=AD=A6?= =?UTF-8?q?=E6=9C=9F=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index a862753ef..411de1dcf 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -561,12 +561,13 @@ module CoursesHelper 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 + year_now = Time.now.month < 3 ? Time.now.year - 1:Time.now.year + if course.time == year_now && course.term == cur_course_term is_current_term = true end - if cur_course_term == "秋季学期" && course.time == (Time.now.year + 1) && course.term == "春季学期" + if cur_course_term == "秋季学期" && course.time == (year_now + 1) && course.term == "春季学期" is_next_term = true - elsif cur_course_term == "春季学期" && course.time == Time.now.year && course.term == "秋季学期" + elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "秋季学期" is_next_term = true end is_current_term || is_next_term