From 8d437eb53934378d009b7ad9fed666617aab2047 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 22 Mar 2018 16:53:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- app/controllers/courses_controller.rb | 4 +++- app/helpers/courses_helper.rb | 2 +- app/views/layouts/_course_base_info.html.erb | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 6d0c1bf30..a53f2bc66 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ unless RUBY_PLATFORM =~ /w32/ gem "rmagick", "= 2.15.4" ## osx must be this version elsif RUBY_PLATFORM =~ /linux/ gem "rmagick", "~> 2.13.1" ## centos yum install ImageMagick-devel + gem 'simple_xlsx_reader' end gem 'certified' gem 'net-ssh', '2.9.1' @@ -14,7 +15,6 @@ unless RUBY_PLATFORM =~ /w32/ gem 'nokogiri' end -gem 'simple_xlsx_reader' gem 'wechat',path: 'lib/wechat' gem 'grack', path:'lib/grack' gem 'gitlab', path: 'lib/gitlab-cli' diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 396f0c06b..bcd6e1422 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -32,7 +32,9 @@ class CoursesController < ApplicationController before_filter :require_login, :only => [:join, :unjoin] #before_filter :allow_join, :only => [:join] - require 'simple_xlsx_reader' + if RUBY_PLATFORM =~ /linux/ + require 'simple_xlsx_reader' + end def sync_temp_excel # unless User.current.admin? diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 2632a3f2c..d98497bed 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -412,7 +412,7 @@ module CoursesHelper members = [] project.members.includes(:user).each do |m| #members << m if m && m.user && m.user.allowed_to?(:as_teacher,project) - members << m if m && m.user && m.user.has_teacher_role(project) + members << m if m && m.user && m.user.has_teacher_role(project) end members end diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 174e8e3c1..54499d176 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -1,5 +1,6 @@ <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> -<% teacher_num = TeacherAndAssistantCount(@course) %> +<% teacher_num = Member.find_by_sql("SELECT count(*) as teacher_count FROM `member_roles` mr, `members` m where m.course_id=#{@course.id} + and m.id=mr.member_id and mr.role_id in ('3','7','9')").first.try(:teacher_count) %> <% student_num = studentCount(@course) %> <% course_file_num = visable_attachemnts_incourse(@course).count %>