diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 2921cc825..185f448ce 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -711,19 +711,19 @@ class CoursesService " limit 0,4" active_students = User.find_by_sql(sql1) if homework_count != 0 && !better_students.empty? - latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 4,:better_students=> better_students} + latest_course_dynamics <<{:type=> 6,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:better_students=> better_students} end unless active_students.empty? - latest_course_dynamics <<{:type=> 7,:time=>Time.now.to_s,:count=> 4,:active_students=>active_students} + latest_course_dynamics <<{:type=> 7,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:active_students=>active_students} end latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics, - :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前"} + :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前",:time=>latest_course_dynamic[:time].to_time} end end #返回数组集合 - result.sort! { |order, newer| newer[:update_time] <=> order[:update_time] } + result.sort! { |order, newer| newer[:time] <=> order[:time] } result end