From 4cb4280c25b4b99c87c4519c475719088e3476f2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 19 Jul 2019 09:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E9=99=A2=E7=BB=9F=E8=AE=A1=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 2 +- app/helpers/colleges_helper.rb | 9 +++++++++ app/views/colleges/_course_statistics.html.erb | 6 ++++-- app/views/colleges/statistics.html.erb | 7 ++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index 418015fd..3cd61f51 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -67,7 +67,7 @@ class CollegesController < ApplicationController user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count) @teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count, - (SELECT count(c.id) FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=users.id AND c.is_delete = 0) as course_count + (SELECT count(c.id) FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=users.id AND c.is_delete = 0) as course_count FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10") # ).order("publish_shixun_count desc, experience desc").limit(10) @teachers = diff --git a/app/helpers/colleges_helper.rb b/app/helpers/colleges_helper.rb index 49a7fdc2..f7238ce6 100644 --- a/app/helpers/colleges_helper.rb +++ b/app/helpers/colleges_helper.rb @@ -14,4 +14,13 @@ module CollegesHelper end type end + + def course_managers teachers + str = "" + teachers.each_with_index do |teacher, index| + str += "、" if index > 0 + str += teacher.user.try(:show_real_name) + end + str + end end diff --git a/app/views/colleges/_course_statistics.html.erb b/app/views/colleges/_course_statistics.html.erb index d112c839..67e989f3 100644 --- a/app/views/colleges/_course_statistics.html.erb +++ b/app/views/colleges/_course_statistics.html.erb @@ -2,7 +2,7 @@ - + @@ -16,7 +16,9 @@ <% @courses.each do |course| %> - + diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb index 98c5be73..3c842539 100644 --- a/app/views/colleges/statistics.html.erb +++ b/app/views/colleges/statistics.html.erb @@ -100,7 +100,12 @@

在线实训情况

-
+ <% if @shixun_tags_name.size == 0 %> + <%= render :partial => 'welcome/no_data' %> +
+ <% else %> +
+ <% end %>
名称创建教师管理教师 评测次数 学生 实训作业
<%= course.name %><%= course.username %> + <%= course_managers course.teachers %> + <%= course.evaluating_count %> <%= course.student_count.to_i %> <%= course.hcm_count.to_i %>