课程代码优化

This commit is contained in:
daiao 2018-03-22 16:53:14 +08:00
parent 2ea79057c9
commit 8d437eb539
4 changed files with 7 additions and 4 deletions

View File

@ -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'

View File

@ -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?

View File

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

View File

@ -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 %>
<p class="sy_cgrey mb10 mr20">