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