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 %>