From d62ffc27ff296cad92c4792f3571cd1ad73bdbc3 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 11 Apr 2019 17:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=9C=E5=90=88=E4=BD=9C=E4=BC=99=E4=BC=B4?= =?UTF-8?q?=E2=80=9D=E7=9A=84=E7=AE=A1=E7=90=86=E5=91=98=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=9C=A8=E2=80=9C=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86=E2=80=9D?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=AD=E5=A2=9E=E5=8A=A0=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=8A=A8=E6=80=81=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/school.rb | 6 ++++++ app/views/cooperates/_partner_item.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/school.rb b/app/models/school.rb index 62e27987..8d377e97 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -66,4 +66,10 @@ class School < ActiveRecord::Base dep = departments.where("identifier is not null").first url = dep.present? ? "/colleges/#{dep.identifier}/statistics" : "" end + + def course_act_time + CourseActivity.find_by_sql("SELECT max(ca.updated_at) as max_update FROM course_activities ca left join courses on ca.course_id = + courses.id LEFT JOIN user_extensions ON courses.tea_id=user_extensions.user_id WHERE + user_extensions.`school_id` = #{self.id}").first.try(:max_update) + end end diff --git a/app/views/cooperates/_partner_item.html.erb b/app/views/cooperates/_partner_item.html.erb index 09490e39..87b94c8e 100644 --- a/app/views/cooperates/_partner_item.html.erb +++ b/app/views/cooperates/_partner_item.html.erb @@ -19,7 +19,7 @@ <%= school.course_count %> <%= school.shixun_count %> <%= school.shixun_report_count %> - 2019-04-11 时间 + <%= school.course_act_time.present? ? format_time(school.course_act_time) : "--" %> <% if school.statistic_url != "" %> 查看