From 987ff98141ded9de15a4d8a159eeadf47cfc31d3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 20 Jul 2015 15:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8C=89=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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