课程资源不能引用问题。原因:15年1-3月能属于2014年秋季学期,代码却将其判断为15年秋季学期了

This commit is contained in:
z9hang 2015-01-19 15:00:46 +08:00
parent 3315116832
commit abcf06ccc7
1 changed files with 4 additions and 3 deletions

View File

@ -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