diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 00c7d9557..5db2d0cf5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -177,9 +177,7 @@ class UsersController < ApplicationController @memberships_done = [] now_time = Time.now @memberships.map { |e| - (@memberships_doing.push(e);next) if e.project.course_extra.endup_time.nil? - end_time_str = e.project.course_extra.endup_time - end_time = Time.parse(end_time_str) + end_time = e.project.course_extra.get_endup_time if end_time > now_time @memberships_doing.push e else diff --git a/app/models/course.rb b/app/models/course.rb index 155ad068f..9fff8713a 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -17,5 +17,15 @@ class Course < ActiveRecord::Base 'term', 'password' + def get_endup_time + begin + end_time = Time.parse(self.endup_time) + rescue Exception => e + end_time = Time.parse("3000-01-01") + Rails.logger.error "[Error] course endup_time error. ===> #{e}" + ensure + return end_time + end + end end