diff --git a/Gemfile b/Gemfile index 9f31edad1..a599613ba 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org/' -### 这里执行bundle config mirror.https://rubygems.org https://gems.ruby-china.org 切换到ruby-china源 +### 锟斤拷锟斤拷执锟斤拷bundle config mirror.https://rubygems.org https://gems.ruby-china.org 锟叫伙拷锟斤拷ruby-china源 unless RUBY_PLATFORM =~ /w32/ # unix-like only diff --git a/Gemfile.lock~ b/Gemfile.lock~ new file mode 100644 index 000000000..7d6563465 --- /dev/null +++ b/Gemfile.lock~ @@ -0,0 +1,386 @@ +GIT + remote: http://github.com/guange2015/wechat.git + revision: a18c3d6603cb1aa7bd1fe887b17f67426be01f35 + specs: + wechat (0.7.1) + activerecord (>= 3.2, < 5.1.x) + http (~> 1.0, >= 1.0.1) + nokogiri (>= 1.6.0) + thor + +PATH + remote: lib/gitlab-cli + specs: + gitlab (3.2.0) + httparty + terminal-table + +PATH + remote: lib/grack + specs: + grack (2.0.2) + rack (~> 1.4.5) + +PATH + remote: lib/rails_kindeditor + specs: + rails_kindeditor (0.4.5) + carrierwave + mini_magick + +GEM + remote: https://ruby.taobao.org/ + specs: + actionmailer (3.2.22.2) + actionpack (= 3.2.22.2) + mail (~> 2.5.4) + actionpack (3.2.22.2) + activemodel (= 3.2.22.2) + activesupport (= 3.2.22.2) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.5) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.2.1) + activemodel (3.2.22.2) + activesupport (= 3.2.22.2) + builder (~> 3.0.0) + activerecord (3.2.22.2) + activemodel (= 3.2.22.2) + activesupport (= 3.2.22.2) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.22.2) + activemodel (= 3.2.22.2) + activesupport (= 3.2.22.2) + activesupport (3.2.22.2) + i18n (~> 0.6, >= 0.6.4) + multi_json (~> 1.0) + acts-as-taggable-on (2.4.1) + rails (>= 3, < 5) + addressable (2.4.0) + ansi (1.5.0) + arel (3.0.3) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) + better_errors (1.1.0) + coderay (>= 1.0.0) + erubis (>= 2.6.6) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.0.0) + byebug (8.2.2) + carrierwave (0.10.0) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + json (>= 1.7) + mime-types (>= 1.16) + chinese_pinyin (1.0.0) + climate_control (0.0.3) + activesupport (>= 3.0) + cocaine (0.5.8) + climate_control (>= 0.0.3, < 1.0) + coderay (1.1.1) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.10.0) + daemons (1.2.3) + debug_inspector (0.0.2) + delayed_job (4.1.1) + activesupport (>= 3.0, < 5.0) + delayed_job_active_record (4.1.0) + activerecord (>= 3.0, < 5) + delayed_job (>= 3.0, < 5) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + diff-lcs (1.2.5) + domain_name (0.5.20160216) + unf (>= 0.0.5, < 1.0.0) + elasticsearch (1.0.15) + elasticsearch-api (= 1.0.15) + elasticsearch-transport (= 1.0.15) + elasticsearch-api (1.0.15) + multi_json + elasticsearch-model (0.1.8) + activesupport (> 3) + elasticsearch (> 0.4) + hashie + elasticsearch-rails (0.1.8) + elasticsearch-transport (1.0.15) + faraday + multi_json + equalizer (0.0.11) + erubis (2.7.0) + execjs (2.6.0) + factory_girl (4.5.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.6.0) + factory_girl (~> 4.5.0) + railties (>= 3.0.0) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) + fastercsv (1.5.5) + grape (0.9.0) + activesupport + builder + hashie (>= 2.1.0) + multi_json (>= 1.3.2) + multi_xml (>= 0.5.2) + rack (>= 1.3.0) + rack-accept + rack-mount + virtus (>= 1.0.0) + grape-entity (0.4.8) + activesupport + multi_json (>= 1.3.2) + grape-swagger (0.10.4) + grape (>= 0.8.0) + grape-entity (< 0.5.0) + hashie (3.4.3) + hike (1.2.3) + htmlentities (4.3.4) + http (1.0.2) + addressable (~> 2.3) + http-cookie (~> 1.0) + http-form_data (~> 1.0.1) + http_parser.rb (~> 0.6.0) + http-cookie (1.0.2) + domain_name (~> 0.5) + http-form_data (1.0.1) + http_parser.rb (0.6.0) + httparty (0.13.7) + json (~> 1.8) + multi_xml (>= 0.5.2) + i18n (0.6.11) + ice_nine (0.11.2) + iconv (1.0.4) + journey (1.0.4) + jquery-rails (2.0.3) + railties (>= 3.1.0, < 5.0) + thor (~> 0.14) + json (1.8.3) + kaminari (0.16.3) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + libv8 (3.16.14.13) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + method_source (0.8.2) + mime-types (1.25.1) + mini_magick (4.4.0) + mini_portile2 (2.0.0) + multi_json (1.11.2) + multi_xml (0.5.5) + multipart-post (2.0.0) + mysql2 (0.3.18) + net-ldap (0.3.1) + netrc (0.11.0) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) + paperclip (3.5.4) + activemodel (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (~> 0.5.3) + mime-types + polyglot (0.3.5) + pry (0.10.3) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-byebug (3.3.0) + byebug (~> 8.0) + pry (~> 0.10) + pry-rails (0.3.4) + pry (>= 0.9.10) + pry-stack_explorer (0.4.9.2) + binding_of_caller (>= 0.7) + pry (>= 0.9.11) + rack (1.4.7) + rack-accept (0.4.5) + rack (>= 0.4) + rack-cache (1.6.1) + rack (>= 0.4) + rack-cors (0.4.0) + rack-mount (0.8.3) + rack (>= 1.0.0) + rack-openid (1.4.2) + rack (>= 1.1.0) + ruby-openid (>= 2.1.8) + rack-raw-upload (1.1.1) + multi_json + rack-ssl (1.3.4) + rack + rack-test (0.6.3) + rack (>= 1.0) + rails (3.2.22.2) + actionmailer (= 3.2.22.2) + actionpack (= 3.2.22.2) + activerecord (= 3.2.22.2) + activeresource (= 3.2.22.2) + activesupport (= 3.2.22.2) + bundler (~> 1.0) + railties (= 3.2.22.2) + railties (3.2.22.2) + actionpack (= 3.2.22.2) + activesupport (= 3.2.22.2) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (10.5.0) + rdoc (3.12.2) + json (~> 1.4) + redis (3.2.2) + redis-actionpack (3.2.4) + actionpack (~> 3.2.0) + redis-rack (~> 1.4.4) + redis-store (~> 1.1.4) + redis-activesupport (3.2.5) + activesupport (~> 3.2.0) + redis-store (~> 1.1.0) + redis-rack (1.4.4) + rack (~> 1.4.0) + redis-store (~> 1.1.4) + redis-rails (3.2.4) + redis-actionpack (~> 3.2.4) + redis-activesupport (~> 3.2.4) + redis-store (~> 1.1.4) + redis-store (1.1.7) + redis (>= 2.2) + ref (2.0.0) + rest-client (1.8.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) + rich (1.4.6) + jquery-rails + kaminari + mime-types + paperclip + rack-raw-upload + rails (>= 3.2.0) + sass-rails + rspec-core (3.4.3) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-rails (3.4.2) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) + ruby-ole (1.2.12) + ruby-openid (2.1.8) + rubyzip (1.2.0) + sass (3.4.21) + sass-rails (3.2.6) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + seems_rateable (1.0.13) + jquery-rails + rails + slop (3.6.0) + spreadsheet (1.1.1) + ruby-ole (>= 1.0) + sprockets (2.2.3) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + terminal-table (1.5.2) + therubyracer (0.12.2) + libv8 (~> 3.16.14.0) + ref + thor (0.19.1) + thread_safe (0.3.5) + tilt (1.4.1) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.46) + uglifier (2.7.2) + execjs (>= 0.3.0) + json (>= 1.8.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.2) + virtus (1.0.5) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) + equalizer (~> 0.0, >= 0.0.9) + +PLATFORMS + ruby + +DEPENDENCIES + acts-as-taggable-on (= 2.4.1) + ansi + better_errors (~> 1.1.0) + binding_of_caller + builder (= 3.0.0) + chinese_pinyin + coderay (~> 1.1.0) + coffee-rails (~> 3.2.1) + daemons + delayed_job_active_record + elasticsearch-model + elasticsearch-rails + factory_girl_rails + fastercsv (~> 1.5.0) + gitlab! + grack! + grape (~> 0.9.0) + grape-entity + grape-swagger + htmlentities + i18n (~> 0.6.0) + iconv + jquery-rails (~> 2.0.2) + kaminari + mysql2 (= 0.3.18) + net-ldap (~> 0.3.1) + paperclip (~> 3.5.4) + pry-byebug + pry-rails + pry-stack_explorer + rack-cors + rack-openid + rails (~> 3.2) + rails_kindeditor! + redis-rails + rest-client + rich (= 1.4.6) + rspec-rails (~> 3.0) + ruby-ole + ruby-openid (~> 2.1.4) + rubyzip + sass-rails (~> 3.2.3) + seems_rateable (~> 1.0.13) + spreadsheet + therubyracer + uglifier (>= 1.0.3) + wechat! + +BUNDLED WITH + 1.10.6 diff --git a/Gemfile~ b/Gemfile~ new file mode 100644 index 000000000..24869e72b --- /dev/null +++ b/Gemfile~ @@ -0,0 +1,112 @@ +source 'http://rubygems.org/' +### 这里执行bundle config mirror.https://rubygems.org https://gems.ruby-china.org 切换到ruby-china源 + +unless RUBY_PLATFORM =~ /w32/ + # unix-like only + gem 'iconv' +end + +gem 'certified' + +gem 'wechat',path: 'lib/wechat' +gem 'grack', path:'lib/grack' +gem 'gitlab', path: 'lib/gitlab-cli' +gem 'rest-client' +gem "mysql2", "= 0.3.18" +gem 'redis-rails' +gem 'rubyzip' +gem 'delayed_job_active_record'#, :group => :production +gem 'daemons' +gem 'grape', '~> 0.9.0' +gem 'grape-entity' +gem 'rack-cors', :require => 'rack/cors' +gem 'seems_rateable', '~> 1.0.13' +gem 'rails', '~> 3.2' +gem "jquery-rails", "~> 2.0.2" +gem "i18n", "~> 0.6.0" +gem 'coderay', '~> 1.1.0' +gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] +gem "builder", "3.0.0" +gem 'acts-as-taggable-on', '2.4.1' +gem 'spreadsheet' +gem 'ruby-ole' +gem 'rails_kindeditor',path:'lib/rails_kindeditor' +#gem "rmagick", ">= 2.0.0" +gem 'binding_of_caller' +gem 'chinese_pinyin' +# gem 'sunspot_rails', '~> 1.3.3' +# gem 'sunspot_solr' +# gem 'sunspot' +# gem 'progress_bar' +gem 'ansi' + +gem 'kaminari' +gem 'elasticsearch-model' +gem 'elasticsearch-rails' + + +### profile +#gem 'oneapm_rpm' + +group :development do + gem 'grape-swagger' + gem 'better_errors', '~> 1.1.0' + # gem "query_reviewer" + # gem 'rack-mini-profiler', '~> 0.9.3' + if RUBY_PLATFORM =~ /w32/ + gem 'win32console' + end +end + +group :development, :test do + unless RUBY_PLATFORM =~ /w32/ + gem 'pry-rails' + if RUBY_VERSION >= '2.0.0' + gem 'pry-byebug' + end + gem 'pry-stack_explorer' + if RUBY_PLATFORM =~ /darwin/ + gem 'puma' + end + end + + gem 'rspec-rails', '~> 3.0' + gem 'factory_girl_rails' +end + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + gem 'therubyracer', :platforms => :ruby + + gem 'uglifier', '>= 1.0.3' +end + +# Optional gem for LDAP authentication +group :ldap do + gem "net-ldap", "~> 0.3.1" +end + + +# Optional gem for OpenID authentication +group :openid do + gem "ruby-openid", "~> 2.1.4", :require => "openid" + gem "rack-openid" +end + + +database_file = File.join(File.dirname(__FILE__), "config/database.yml") +if File.exist?(database_file) +else + warn("Please configure your config/database.yml first") +end + +# Load plugins' Gemfiles +Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file| + puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` + instance_eval File.read(file) +end diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 94ee14a56..cbd43bb79 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -33,10 +33,10 @@ module Mobile shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id) shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) page = params[:page] ? params[:page] : 0 - user_project_ids = (user.projects.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (user.courses.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.map{|course| course.id}-shield_course_ids).join(",") + ")" + user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.map{|project| project.id}-shield_project_ids).join(",") + ")" + user_course_ids = (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.map{|course| course.id}-shield_course_ids).join(",") + ")" course_types = "('Message','News','HomeworkCommon','Poll','Course')" - project_types = "('Message','Issue','ProjectCreateInfo')" + project_types = "('Message','Issue','Project')" principal_types = "JournalsForMessage" watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(',')) user_ids = "(" + user.id.to_s + watched_user_ids + ")" diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 20876bf69..3ba82bcb9 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -14,7 +14,7 @@ module Mobile else case f when :user_act - if ac.act_type == "ProjectCreateInfo" + if ac.act_type == "Project" ac unless ac.nil? else ac.act unless ac.nil? || ac.act.nil? @@ -84,10 +84,10 @@ module Mobile elsif ac.container_type == "Project" case ac.act_type when "Issue" - "椤圭洰缂洪櫡" + "椤圭洰闂" when "Message" "椤圭洰璁ㄨ鍖" - when "ProjectCreateInfo" + when "Project" "椤圭洰" end end @@ -101,7 +101,7 @@ module Mobile expose :container_type #璇剧▼/椤圭洰/鍗氬/涓汉 expose :author, using: Mobile::Entities::User do |a, opt| #鐢ㄦ埛淇℃伅 if a.is_a? ::UserActivity - if a.act_type == "ProjectCreateInfo" + if a.act_type == "Project" get_user(get_project(a.act_id).user_id) elsif !a.act.nil? if a.act_type == 'Issue' || a.act_type == 'News' || a.act_type == 'Message' || a.act_type == 'BlogComment' diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d6470ce51..cbce67618 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -363,7 +363,11 @@ class ApplicationController < ActionController::Base when "contest" return true when "Course" - allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false) + if @attachment.get_status_by_attach(User.current.id) == 2 + return true + else + allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false) + end else return true end diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index fe16385f4..5b29565ad 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -68,7 +68,7 @@ class AtController < ApplicationController end def find_project(id) - return [] if id<0 + return [] if id.to_i<0 at_persons = Project.find(id).users at_persons.delete_if { |u| u.id == User.current.id } end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0fd4cc2c9..17f62f18c 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -162,6 +162,7 @@ class CoursesController < ApplicationController @subPage_title = l :label_student_list @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' # @is_remote = true + @sort_type = 'score' @score_sort_by = "desc" q = "#{params[:name].strip}" if params[:incourse] @@ -185,9 +186,11 @@ class CoursesController < ApplicationController group.course_id = @course.id group.save end + @sort_type = 'score' + @score_sort_by = "desc" @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' @is_remote = true - @members = student_homework_score(0,0, 10,"desc") + @members = student_homework_score(0,0, 10,@score_sort_by) @course_groups = @course.course_groups end @@ -196,7 +199,9 @@ class CoursesController < ApplicationController @subPage_title = l :label_student_list @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' @is_remote = true - + @sort_type = 'score' + @score_sort_by = "desc" + @members = student_homework_score(0,0, 10,@score_sort_by) @course_groups = @course.course_groups end @@ -281,6 +286,7 @@ class CoursesController < ApplicationController @render_file = 'new_member_list' @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' @is_remote = true + @sort_type = 'score' @score_sort_by = "desc" if params[:group_id] && params[:group_id] != "0" @group = CourseGroup.find(params[:group_id]) @@ -298,6 +304,7 @@ class CoursesController < ApplicationController @render_file = 'new_member_list' @score_sort_by = "desc" + @sort_type = "score" @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' @role = params[:role].nil? ? '2':params[:role] @is_remote = true @@ -312,7 +319,7 @@ class CoursesController < ApplicationController if @course.open_student == 1 || User.current.member_of_course?(@course) @subPage_title = l :label_student_list page = params[:page].nil? ? 0 : (params['page'].to_i - 1) - @all_members = student_homework_score(0,page, 10,"desc") + @all_members = student_homework_score(0,page, 10,@score_sort_by) @members = @all_members else render_403 @@ -334,7 +341,7 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") - @homeworks = @course.homework_commons.order("created_at asc") + @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at asc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; respond_to do |format| @@ -350,28 +357,29 @@ class CoursesController < ApplicationController @subPage_title = l :label_student_list @render_file = 'new_member_list' @is_remote = true + @sort_type = params[:sort_type] if params[:sort_type] @score_sort_by = params[:sort_by] if params[:sort_by] @search_name = params[:search_name] if params[:search_name] group_id = params[:group_id] if !@search_name.nil? if group_id == '0' page = params[:page].nil? ? 0 : (params['page'].to_i - 1) - @results = searchmember_by_name(student_homework_score(0,0,0,@score_sort_by), @search_name) + @results = searchmember_by_name(student_homework_score(0,0,0,@score_sort_by,@sort_type), @search_name) @result_count = @results.count # @results = paginateHelper @results, 10 else @group = CourseGroup.find(group_id) - @results = searchmember_by_name(student_homework_score(group_id, 0, 0,@score_sort_by),@search_name) + @results = searchmember_by_name(student_homework_score(group_id, 0, 0,@score_sort_by,@sort_type),@search_name) @result_count = @results.count # @results = paginateHelper @results, 10 end else if group_id == '0' page = params[:page].nil? ? 0 : (params['page'].to_i - 1) - @results = student_homework_score(0,page, 10,@score_sort_by) + @results = student_homework_score(0,page, 10,@score_sort_by,@sort_type) else @group = CourseGroup.find(group_id) - @results = student_homework_score(group_id, 0, 0,@score_sort_by) + @results = student_homework_score(group_id, 0, 0,@score_sort_by,@sort_type) end end end @@ -384,6 +392,15 @@ class CoursesController < ApplicationController end end + # 鏄剧ず姣忎釜瀛︾敓鐨勪綔涓氳瘎鍒嗚鎯 + def show_member_act_score + @member = Member.find(params[:member_id]) if params[:member_id] + respond_to do |format| + format.html {render :layout => 'course_base'} + format.js + end + end + def handle_course courses, activities course_activity_count_array=activities.values() course_array=[] @@ -1149,7 +1166,7 @@ class CoursesController < ApplicationController end end - def student_homework_score(groupid,start_from, nums, score_sort_by) + def student_homework_score(groupid,start_from, nums, score_sort_by, sort_type = 'score') start_from = start_from * nums sql_select = "" if groupid == 0 @@ -1159,11 +1176,13 @@ class CoursesController < ApplicationController WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} AND student_works.user_id = members.user_id - ) AS score + ) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + + resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id + ) AS act_score FROM members JOIN students_for_courses ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id - WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" + WHERE members.course_id = #{@course.id} ORDER BY #{sort_type} #{score_sort_by}" else sql_select = "SELECT members.*,( SELECT SUM(student_works.work_score) @@ -1171,11 +1190,13 @@ class CoursesController < ApplicationController WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} AND student_works.user_id = members.user_id - ) AS score + ) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + + resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{@course.id} AND ccs.user_id = members.user_id + ) AS act_score FROM members JOIN students_for_courses ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id - WHERE members.course_id = #{@course.id} AND members.course_group_id = #{groupid} ORDER BY score #{score_sort_by}" + WHERE members.course_id = #{@course.id} AND members.course_group_id = #{groupid} ORDER BY #{sort_type} #{score_sort_by}" end sql = ActiveRecord::Base.connection() homework_scores = Member.find_by_sql(sql_select) @@ -1225,8 +1246,7 @@ class CoursesController < ApplicationController sheet1[5,i+4] = "绗"+(i+1).to_s+"娆" end sheet1[5,homeworks.count+4] = "鎬绘垚缁" - sheet1[5,0] = "鎺掑悕" - sheet1[5,0] = "鎺掑悕" + sheet1[5,homeworks.count+5] = "娲昏穬搴" count_row = 6 members.each_with_index do |member, i| sheet1[count_row,0]= i+1 @@ -1236,14 +1256,15 @@ class CoursesController < ApplicationController homeworks.each_with_index do |homework, j| student_works = homework.student_works.where("user_id = #{member.user.id}") if student_works.empty? - sheet1[count_row,j+4] = format("%0.2f",0) + sheet1[count_row,j+4] = 0 else final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty - sheet1[count_row,j+4] = format("%0.2f",score <0 ? 0:score) + sheet1[count_row,j+4] = score <0 ? 0:score.round(2) end end - sheet1[count_row,homeworks.count+4] = format("%0.2f",member.score.nil? ? 0:member.score.to_s) + sheet1[count_row,homeworks.count+4] = member.score.nil? ? 0:member.score.round(2) + sheet1[count_row,homeworks.count+5] = member.act_score.nil? ? 0:member.act_score count_row += 1 end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 689ef2bd7..9da4b90b9 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -20,15 +20,16 @@ class HomeworkCommonController < ApplicationController @page = params[:page] ? params[:page].to_i + 1 : 0 @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) if @is_teacher - @homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10) + #@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) @homework_commons = @course.homework_commons.order("created_at desc") else - @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10) + #@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) @homework_commons = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc") end @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_new = params[:is_new] + @homeworks = paginateHelper @homework_commons,10 #璁剧疆at宸茶 @homeworks.each do |homework| homework.journals_for_messages.each do |j| @@ -291,9 +292,9 @@ class HomeworkCommonController < ApplicationController def open_student_works if @homework.is_open == 0 - @homework.update_attribute(:is_open, 1) + @homework.update_column('is_open', 1) else - @homework.update_attribute(:is_open, 0) + @homework.update_column('is_open', 0) end @user_activity_id = params[:user_activity_id] @is_in_course = params[:is_in_course] if params[:is_in_course] @@ -440,7 +441,7 @@ class HomeworkCommonController < ApplicationController puts time s_time = time if format_time(time) > format_time(h.updated_at) - h.update_attribute(:updated_at, s_time) + h.update_column('updated_at', s_time) end end end diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index c6047d227..82062d3dd 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -103,6 +103,7 @@ class OrgDocumentCommentsController < ApplicationController def destroy @org_document_comment = OrgDocumentComment.find(params[:id]) + @org_sub_id = @org_document_comment.org_subfield_id org = @org_document_comment.organization if @org_document_comment.id == org.home_id org.update_attributes(:home_id => nil) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 62876d757..3ab62bbea 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -127,7 +127,7 @@ class OrganizationsController < ApplicationController case params[:type] when nil @org_activities = OrgActivity.where("(container_id =? and container_type =?) " + - "or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+ + "or (container_type ='Project' and org_act_type in ('Issue','Message','Project') and container_id in (#{project_ids.join(',')})) "+ "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) when 'project_issue' diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 1d7b4117d..e4cf31f55 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -423,9 +423,13 @@ class PollController < ApplicationController # 灏嗗叾浠栧湴鏂圭殑闂嵎瀵煎嚭鏉 def other_poll # 鏌ヤ綔鑰呮槸鎴戯紝鎴栬呬綔鑰呮槸褰撳墠璇剧▼鐨勮佸笀锛屼笖涓嶅湪褰撳墠璇剧▼鍐呯殑闂嵎 杩涜瀵煎叆 - tea_ids = '(' - tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')' - @polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}") + courses = User.current.courses.select { |course| User.current.allowed_to?(:as_teacher,course)} + course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")" + none_courses = User.current.courses.where("is_delete = 1 or #{Course.table_name}.id = #{params[:polls_group_id].to_i}") + none_course_ids = none_courses.empty? ? "(-1)" : "(" + none_courses.map { |course| course.id}.join(',') + ")" + #tea_ids = '(' + #tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')' + @polls = Poll.where("(user_id = #{User.current.id} or polls_group_id in #{course_ids}) and polls_type = 'course' and polls_group_id not in #{none_course_ids}") @polls_group_id = params[:polls_group_id] respond_to do |format| format.js diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 258bce756..f518f81da 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -81,6 +81,7 @@ class StudentWorkController < ApplicationController #鏍规嵁浼犲叆鐨則Index纭畾鏄鍑犳娴嬭瘯 #涔嬪悗濡傛灉瑙夊緱寰堝崱 鍙互鏀规垚灏嗙粨鏋滀紶鍥濲S鍐嶄互鍙傛暟褰㈠紡浼犲洖鏉 def program_test_ex + tStarttime = Time.now is_test = params[:is_test] == 'true' @@ -106,108 +107,123 @@ class StudentWorkController < ApplicationController tEndtime = Time.now tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 logger.debug "program_test_ex user wait time = #{tUsedtime} 姣" - - #status 0:绛旀姝g‘ -3http瓒呮椂 -2:缂栬瘧閿欒 -1:绛旀閿欒 2:绋嬪簭杩愯瓒呮椂 + #status 0:绛旀姝g‘ -5program_test_ex 鍑芥暟鍑洪敊 -4judge浠g爜鍑洪敊 -3http瓒呮椂 -2:缂栬瘧閿欒 -1:绛旀閿欒 2:绋嬪簭杩愯瓒呮椂 + resultObj[:status] = -3 CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id) - - end - if result["status"].to_i != -2 - #result["results"].first['output'] = result["results"].first['output'].gsub(" ","鈻") - #result["results"].first['result'] = result["results"].first['result'].gsub(" ","鈻") - space_replace_1(result["results"].first['output']) - space_replace_1(result["results"].first['result']) + rescue + #-4 judge浠g爜 鍑洪敊 + logger.debug "program_test_error 1" + resultObj[:status] = -4 + tmpstatus = -4 + CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id) end - logger.debug result + begin + if resultObj[:status] != -3 && resultObj[:status] != -4 + if result["status"].to_i != -2 + #result["results"].first['output'] = result["results"].first['output'].gsub(" ","鈻") + #result["results"].first['result'] = result["results"].first['result'].gsub(" ","鈻") + space_replace_1(result["results"].first['output']) + space_replace_1(result["results"].first['result']) + end - #-1 榛樿鍊 0鍏ㄩ儴姝g‘骞剁粨鏉 2 瓒呮椂 -2 缂栬瘧閿欒 - resultObj[:status] = -1 - resultObj[:results] = result["results"].first #鏈娴嬭瘯缁撴灉 - if result["status"].to_i == -2 #缂栬瘧閿欒 - result["error_msg"] = result["error_msg"][0..2047] - end - resultObj[:error_msg] = result["error_msg"] #缂栬瘧閿欒鏃剁殑淇℃伅 + logger.debug result - #璇ョ姸鎬佺敤浜庡瓨鍏odeTests - tmpstatus = -1 - if result["status"].to_i == -2 #缂栬瘧閿欒 - resultObj[:results] = result["error_msg"] - resultObj[:status] = -2 - tmpstatus = -2 - elsif result["results"][0]["status"].to_i == 2 - resultObj[:status] = 2 - tmpstatus = 2 - end + #-1 榛樿鍊 0鍏ㄩ儴姝g‘骞剁粨鏉 2 瓒呮椂 -2 缂栬瘧閿欒 + resultObj[:status] = -1 + resultObj[:results] = result["results"].first #鏈娴嬭瘯缁撴灉 + if result["status"].to_i == -2 #缂栬瘧閿欒 + result["error_msg"] = result["error_msg"][0..2047] + end + resultObj[:error_msg] = result["error_msg"] #缂栬瘧閿欒鏃剁殑淇℃伅 - if result["status"] == 0 - tmpstatus = 0 - end + #璇ョ姸鎬佺敤浜庡瓨鍏odeTests + tmpstatus = -1 + if result["status"].to_i == -2 #缂栬瘧閿欒 + resultObj[:results] = result["error_msg"] + resultObj[:status] = -2 + tmpstatus = -2 + elsif result["results"][0]["status"].to_i == 2 + resultObj[:status] = 2 + tmpstatus = 2 + end - unless student_work.save - resultObj[:status] = 200 - else - student_work.name = params[:title] - student_work.description = params[:src] + if result["status"] == 0 + tmpstatus = 0 + end - if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") - student_work.late_penalty = @homework.late_penalty - else - student_work.late_penalty = 0 - end + unless student_work.save + resultObj[:status] = 200 + else + student_work.name = params[:title] + student_work.description = params[:src] - #姣忔浠庢暟鎹簱鍙栧嚭涓婃鐨勭粨鏋滃姞涓婃湰娆$殑缁撴灉鍐嶅瓨鍏ユ暟鎹簱 - if result["status"].to_i != -2 - result["results"].first['user_wait'] = tUsedtime + if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + student_work.late_penalty = @homework.late_penalty + else + student_work.late_penalty = 0 + end - if result["results"][0]["status"].to_i == 2 - result["status"] = 2 + #姣忔浠庢暟鎹簱鍙栧嚭涓婃鐨勭粨鏋滃姞涓婃湰娆$殑缁撴灉鍐嶅瓨鍏ユ暟鎹簱 + if result["status"].to_i != -2 + result["results"].first['user_wait'] = tUsedtime + + if result["results"][0]["status"].to_i == 2 + result["status"] = 2 + end + end + + status = result["status"] + if index == 1 + student_work_test = student_work.student_work_tests.build(status: status, + results: [resultObj[:results]],src: params[:src]) + student_work_test.save! + resultObj[:testid] = student_work_test.id + else + #鍏堜粠鏁版嵁搴撳彇鍑簉esult + student_work_test = StudentWorkTest.find(params[:testid]) + results = student_work_test.results + results << resultObj[:results] + student_work_test.results = results + student_work_test.status = (result["status"] != 0 ? result["status"] : student_work_test.status) + student_work_test.save! + status = student_work_test.status + resultObj[:testid] = student_work_test.id + end + + #瓒呮椂鎴栫紪璇戦敊璇垯鐩存帴杩斿洖浜嗗苟瀛樺叆鏁版嵁搴 + if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size + if status == 0 + resultObj[:status] = 0 + end + student_work.save! + resultObj[:time] = student_work_test.created_at.to_s(:db) + resultObj[:index] = student_work.student_work_tests.count + end + + #灏嗘瘡娆$敤鎴风瓑寰呮椂闂撮兘瀛樿捣鏉ヤ互渚跨鐞嗙晫闈㈡樉绀虹敤 + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.debug "program_test_ex user wait time = #{tUsedtime} 姣" + + time_used = 0 + if result["status"].to_i != -2 + #鑷冲皯涓姣 + time_used = result["results"].first['time_used'] == 0 ? 1:result["results"].first['time_used'] + end + #0:绛旀姝g‘ -3http瓒呮椂 -2:缂栬瘧閿欒 -1:绛旀閿欒 2:绋嬪簭杩愯瓒呮椂 + CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>time_used,:wait_time=>tUsedtime,:student_work_id=>student_work.id) end end - - status = result["status"] - if index == 1 - student_work_test = student_work.student_work_tests.build(status: status, - results: [resultObj[:results]],src: params[:src]) - student_work_test.save! - resultObj[:testid] = student_work_test.id - else - #鍏堜粠鏁版嵁搴撳彇鍑簉esult - student_work_test = StudentWorkTest.find(params[:testid]) - results = student_work_test.results - results << resultObj[:results] - student_work_test.results = results - student_work_test.status = (result["status"] != 0 ? result["status"] : student_work_test.status) - student_work_test.save! - status = student_work_test.status - resultObj[:testid] = student_work_test.id - end - - #瓒呮椂鎴栫紪璇戦敊璇垯鐩存帴杩斿洖浜嗗苟瀛樺叆鏁版嵁搴 - if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size - if status == 0 - resultObj[:status] = 0 - end - student_work.save! - resultObj[:time] = student_work_test.created_at.to_s(:db) - resultObj[:index] = student_work.student_work_tests.count - end - - #灏嗘瘡娆$敤鎴风瓑寰呮椂闂撮兘瀛樿捣鏉ヤ互渚跨鐞嗙晫闈㈡樉绀虹敤 - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.debug "program_test_ex user wait time = #{tUsedtime} 姣" - - time_used = 0 - if result["status"].to_i != -2 - #鑷冲皯涓姣 - time_used = result["results"].first['time_used'] == 0 ? 1:result["results"].first['time_used'] - end - #0:绛旀姝g‘ -3http瓒呮椂 -2:缂栬瘧閿欒 -1:绛旀閿欒 2:绋嬪簭杩愯瓒呮椂 - CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>time_used,:wait_time=>tUsedtime,:student_work_id=>student_work.id) - - #娓叉煋杩斿洖缁撴灉 - render :json => resultObj + rescue + #-5 program_test_ex 鍑芥暟鍑洪敊 + logger.debug "program_test_error 2" + resultObj[:status] = -5 + tmpstatus = -5 + CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id) end + #娓叉煋杩斿洖缁撴灉 + render :json => resultObj end end end @@ -360,6 +376,7 @@ class StudentWorkController < ApplicationController ################################################################################################################## @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc") + @all_homework_commons = @course.homework_commons.order("created_at desc") @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? @is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #鏄笉鏄尶璇 @show_all = false @@ -816,7 +833,7 @@ class StudentWorkController < ApplicationController stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") @work.student_score = stu_score.first.score.try(:round, 2).to_f end - @homework.update_attributes(:updated_at => Time.now) + @homework.update_column('updated_at', Time.now) update_course_activity(@homework.class,@homework.id) update_user_activity(@homework.class,@homework.id) update_org_activity(@homework.class,@homework.id) diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb index 767e1ba29..cdf153a20 100644 --- a/app/controllers/sub_document_comments_controller.rb +++ b/app/controllers/sub_document_comments_controller.rb @@ -125,6 +125,8 @@ class SubDocumentCommentsController < ApplicationController def destroy @sub_document_comment = SubDocumentComment.find(params[:id]) @sub_document_comment.destroy + @sub_domain = @sub_document_comment.sub_domain + @org_subfield = @sub_domain.org_subfield rescue ActiveRecord::RecordNotFound respond_to do |format| # format.html{ diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1b4fcd499..2c4355180 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -645,7 +645,7 @@ class UsersController < ApplicationController new_homework.homework_detail_programing.save if new_homework.homework_detail_programing new_homework.homework_detail_group.save if new_homework.homework_detail_group end - homework.update_attribute(:quotes, homework.quotes+1) + homework.update_column(:quotes, homework.quotes+1) end @homework = homework respond_to do |format| @@ -918,7 +918,7 @@ class UsersController < ApplicationController student_work.save send_message_to_teacher(student_work) - homework.update_attributes(:updated_at => Time.now) + homework.update_column(:updated_at, Time.now) update_course_activity(homework.class,homework.id) update_user_activity(homework.class,homework.id) update_org_activity(homework.class,homework.id) @@ -1006,7 +1006,7 @@ class UsersController < ApplicationController homework_detail_group.save if homework_detail_group if params[:quotes] && !params[:quotes].blank? quotes_homework = HomeworkCommon.find params[:quotes].to_i - quotes_homework.update_attribute(:quotes, quotes_homework.quotes+1) + quotes_homework.update_column(:quotes, quotes_homework.quotes+1) end if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => homework.course_id) @@ -1429,7 +1429,7 @@ class UsersController < ApplicationController user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" user_course_ids = (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" - project_types = "('Message','Issue','ProjectCreateInfo')" + project_types = "('Message','Issue','Project')" principal_types = "JournalsForMessage" if params[:type].present? case params[:type] @@ -2705,7 +2705,7 @@ class UsersController < ApplicationController # 鑾峰彇鍏叡璧勬簮鎼滅储 def get_public_resources_search user_course_ids, user_project_ids, order, score, search - attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}") + attachments = Attachment.where("is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") end # 鑾峰彇鎴戠殑璧勬簮 @@ -2816,7 +2816,7 @@ class UsersController < ApplicationController # 鑾峰彇鎴戠殑鐢ㄦ埛绫诲瀷璧勬簮 def get_principal_resources_public order, score - attchments = Attachment.where("container_type = 'Principal'and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("container_type = 'Principal' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") end # 鑾峰彇鎴戠殑鐢ㄦ埛绫诲瀷璧勬簮 diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 30f56a1d9..39be9cef3 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -211,7 +211,7 @@ class WechatsController < ActionController::Base user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" course_types = "('Message','News','HomeworkCommon','Poll','Course')" - project_types = "('Message','Issue','ProjectCreateInfo')" + project_types = "('Message','Issue','Project')" principal_types = "JournalsForMessage" blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1d43ff69a..4d92808d4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,6 +49,30 @@ module ApplicationHelper return result end + # 鍒ゆ柇鏌愪釜璧勬簮鏄惁鍙互鐢宠 + def attach_show_allow attach_id + attachment = Attachment.find(attach_id) + case attachment.container_type + when "Project" + User.current.member_of?(attachment.container) ? true : false + when "Course" + User.current.member_of_course?(attachment.container) ? true : false + when "OrgSubfield" + User.current.member_of_org?(attachment.container.organization) ? true : false + when "Principal" + User.current.id == attachment.author_id ? true : false + end + end + + # 鍒ゆ柇鏌愪釜绉佹湁璧勬簮鏄惁鍙互鍙戦佷笅杞芥潈闄 + # 缁撴灉涓簍rue涓嶈兘涓嬭浇锛宖alse鍙互涓嬭浇 + def private_attachment_allow attachment_id + attach = Attachment.find(attachment_id) + # 鏉′欢鍙栧惁锛宺esult缁撴灉涓簍rue鍒欎笉鑳戒笅杞 + result = attach.is_public == 0 && attach.author != User.current && !attach.get_apply_resource_status(attach.id, User.current.id) && !attach_show_allow(attach) + return result + end + # Time 2015-03-24 15:27:29 # Author lizanle # Description 浠庣‖鐩樹笂鍒犻櫎瀵瑰簲鐨勮祫婧愭枃浠 @@ -2094,20 +2118,20 @@ module ApplicationHelper candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1) elsif attachment.container.is_a?(Project) project = attachment.container - candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1) + candown = User.current.member_of?(project) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2 elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board && attachment.container.board.project project = attachment.container.board.project candown = User.current.member_of?(project) || (project.is_public && attachment.is_public == 1) elsif (attachment.container.has_attribute?(:course) ||attachment.container.has_attribute?(:course_id) ) && attachment.container.course course = attachment.container.course - candown = User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) + candown = User.current.member_of_course?(course) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2 elsif attachment.container.is_a?(Course) course = attachment.container - candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) + candown= User.current.member_of_course?(course) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2 elsif attachment.container.is_a?(OrgSubfield) org = attachment.container.organization - candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1) + candown = User.current.member_of_org?(org) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2 elsif attachment.container.is_a?(OrgDocumentComment) org = attachment.container.organization candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1) @@ -3237,6 +3261,7 @@ def strip_html(text,len=0,endss="...") ss = "" if text.length>0 ss=text.gsub(/<\/?.*?>/, '').strip + ss = ss.gsub(/ /, ' ') if len > 0 && ss.length > len ss = ss[0, len] + endss @@ -3247,3 +3272,14 @@ def strip_html(text,len=0,endss="...") end return ss end + +def get_hw_index(hw,is_teacher) + if is_teacher + homeworks = hw.course.homework_commons.order("created_at asc") + else + homeworks = hw.course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at asc") + end + hw_ids = homeworks.map{|hw| hw.id} if !homeworks.empty? + index = hw_ids.index(hw.id) + return index +end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index b7ec264fd..8f9ee2d85 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -142,7 +142,8 @@ class Attachment < ActiveRecord::Base end def get_apply_resource_status attachment_id, author_id - ApplyResource.where("attachment_id =? and apply_user_id =?", attachment_id, author_id).first.try(:status) + status = ApplyResource.where("attachment_id =? and user_id =?", attachment_id, author_id).first.try(:status) + status == 2 ? true :false end # add by nwb diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 96ec6e355..2aae45d0a 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -5,8 +5,7 @@ class CourseActivity < ActiveRecord::Base belongs_to :course belongs_to :user has_many :user_acts, :class_name => 'UserAcivity',:as =>:act - after_save :add_user_activity, :add_org_activity - after_create :add_course_lead + after_create :add_course_lead,:add_user_activity, :add_org_activity before_destroy :destroy_user_activity, :destroy_org_activity #鍦ㄤ釜浜哄姩鎬侀噷闈㈠鍔犲綋鍓嶅姩鎬 diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index c044392a0..44b13b315 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -20,7 +20,7 @@ class ForgeActivity < ActiveRecord::Base validates :forge_act_id,presence: true validates :forge_act_type, presence: true has_many :user_acts, :class_name => 'UserAcivity',:as =>:act - after_save :add_user_activity, :add_org_activity + after_create :add_user_activity, :add_org_activity before_destroy :destroy_user_activity, :destroy_org_activity #鍦ㄤ釜浜哄姩鎬侀噷闈㈠鍔犲綋鍓嶅姩鎬 diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index f11a48a80..e4426e78f 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -29,8 +29,8 @@ class HomeworkCommon < ActiveRecord::Base :description => :description, :author => :author, :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} - after_create :act_as_activity, :send_mail - after_update :update_activity + after_create :act_as_activity, :send_mail,:act_as_course_message + after_update :update_activity, :wechat_message after_save :act_as_course_activity after_destroy :delete_kindeditor_assets @@ -59,12 +59,12 @@ class HomeworkCommon < ActiveRecord::Base else self.course.members.each do |m| # if m.user_id != self.user_id - self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) - #count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count - #if count == 0 - # ws = WechatService.new - # ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59") - #end + #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count + if count == 0 + ws = WechatService.new + ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59") + end # end end end diff --git a/app/models/issue.rb b/app/models/issue.rb index d5d148117..b5e87feea 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -164,7 +164,20 @@ class Issue < ActiveRecord::Base count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count if m.user_id != self.author_id && count == 0 ws = WechatService.new - content = strip_html self.project.name + " 鏈夋柊缂洪櫡浜嗭細" + self.subject.html_safe, 200 + str = " 鏈夋柊缂洪櫡浜嗭細 " + case self.tracker_id + when 1 + str = " 鏈夋柊缂洪櫡浜嗭細 " + when 2 + str = " 鏈夋柊鍔熻兘浜嗭細 " + when 3 + str = " 鏈夋柊鏀寔浜嗭細 " + when 4 + str = " 鏈夋柊浠诲姟浜嗭細 " + when 5 + str = " 鏈夋柊鍛ㄦ姤浜嗭細 " + end + content = strip_html self.project.name + str + self.subject.html_safe, 200 ws.message_update_template m.user_id, "issues", self.id, "#{l(:label_new_issue_template)}", content, format_time(self.created_on) end end diff --git a/app/models/journal.rb b/app/models/journal.rb index 02086fa62..eeaa17dd6 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -239,8 +239,10 @@ class Journal < ActiveRecord::Base #缂洪櫡鍥炲寰俊妯℃澘娑堟伅 def issue_wechat_message - ws = WechatService.new - content = strip_html self.notes.html_safe, 200 - ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + if !self.notes.nil? && self.notes.gsub(' ','') != '' + ws = WechatService.new + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 4b5ac227f..d0113744c 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -259,14 +259,25 @@ class JournalsForMessage < ActiveRecord::Base if self.m_parent_id.nil? if self.user_id != self.jour.user_id self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count + if count == 0 + ws = WechatService.new + #content = truncate(strip_tags(self.notes.to_s), length: 200) + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end + end + else + if self.user_id != self.parent.user_id + self.course_messages << CourseMessage.new(:user_id => self.parent.user_id,:course_id => self.jour.course.id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.parent.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count + if count == 0 + ws = WechatService.new + #content = truncate(strip_tags(self.notes.to_s), length: 200) + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.parent.user_id, "homework", self.jour_id, "#{l(:label_new_second_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end - end - count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count - if count == 0 - ws = WechatService.new - #content = truncate(strip_tags(self.notes.to_s), length: 200) - content = strip_html self.notes.html_safe, 200 - ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content end end end diff --git a/app/models/message.rb b/app/models/message.rb index 7bfb9d80e..fdc3c6bdc 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -274,7 +274,7 @@ class Message < ActiveRecord::Base else # 鍥炲笘 parent_author_id = Message.find(self.parent_id).author_id if parent_author_id != self.author_id # 鍙拡瀵逛富璐村洖澶嶏紝鍥炲鑷繁鐨勫笘瀛愪笉鍙戞秷鎭 - #self.course_messages << CourseMessage.new(:user_id => parent_author_id, :course_id => self.board.course_id, :viewed => false) + self.course_messages << CourseMessage.new(:user_id => parent_author_id, :course_id => self.board.course_id, :viewed => false) count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Course' and shield_id=#{self.board.course_id}").count if count == 0 content = strip_html self.content.html_safe, 200 @@ -297,7 +297,7 @@ class Message < ActiveRecord::Base else # 鍥炲笘 parent_author_id = Message.find(self.parent_id).author_id if parent_author_id != self.author_id # 鍙拡瀵逛富璐村洖澶嶏紝鍥炲鑷繁鐨勫笘瀛愪笉鍙戞秷鎭 - #self.forge_messages << ForgeMessage.new(:user_id => parent_author_id, :project_id => self.board.project_id, :viewed => false) + self.forge_messages << ForgeMessage.new(:user_id => parent_author_id, :project_id => self.board.project_id, :viewed => false) count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Project' and shield_id=#{self.board.project_id}").count if count == 0 content = strip_html self.content.html_safe, 200 diff --git a/app/models/news.rb b/app/models/news.rb index f0457dc81..a411ccaca 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -62,7 +62,7 @@ class News < ActiveRecord::Base :author_key => :author_id acts_as_watchable - after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score + after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message after_update :update_activity after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score @@ -169,12 +169,12 @@ class News < ActiveRecord::Base if self.course self.course.members.each do |m| if m.user_id != self.author_id - self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) + #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count if count == 0 ws = WechatService.new content = strip_html self.author.try(:realname) + " 鍙戝竷浜嗛氱煡锛" + self.title.html_safe, 200 - ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.author.try(:realname) + " 鍙戝竷浜嗛氱煡锛" + content, format_time(self.created_on) + ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", content, format_time(self.created_on) end end end diff --git a/app/models/sso.rb b/app/models/sso.rb index a58b5e442..c987ff933 100644 --- a/app/models/sso.rb +++ b/app/models/sso.rb @@ -17,7 +17,7 @@ class Sso < ActiveRecord::Base sso.openid = opt["openid"] sso.email = opt["email"] sso.password = opt["password"] - sso.school = Base64.decode64(opt["school"]).force_encoding('utf-8') + sso.school = opt["school"] sso.sex = opt["sex"] diff --git a/app/views/admin/code_work_tests.html.erb b/app/views/admin/code_work_tests.html.erb index 64c3a41e1..2013bd322 100644 --- a/app/views/admin/code_work_tests.html.erb +++ b/app/views/admin/code_work_tests.html.erb @@ -24,8 +24,8 @@
<%= count>0 ? "#{count}" :"0" %> 鍥炲 diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index c7e4a7428..1050a59b9 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -36,7 +36,7 @@
鍙栨秷 - 鐣欒█ + 鐣欒█ <% end %>+ 搴忓彿 + + 濮撳悕 + 瀛﹀彿 + 鐝骇 + | ++ <%= link_to "鏃堕棿",'',:class => "c_dark f14 fb fl ml50" ,:remote => true%> + | ++ <%= link_to "鎴愮哗",'',:class => "c_dark f14 fb fl ml10",:remote => true%> + | +||||||
---|---|---|---|---|---|---|---|---|
1 | ++ <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %> + | ++ <%=exercise.user.show_name %> + | ++ <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> + | ++ -- + | ++ | + <% if exercise.created_at%> + <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%> + <% if @exercise.end_time <= exercise.created_at %> + [鏈瓟] + <% end %> + <% end %> + | ++ <%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%> + | +
搴忓彿 | ++ | 浣滃搧鍚嶇О | <% if @homework.homework_type != 3 %> -+ 濮撳悕 + | ++ 瀛﹀彿 + | <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> -+ 鍏宠仈椤圭洰 + | <% end %> - -+ 鏃堕棿 + | + <% if @homework.homework_type == 2%> ++ 绯荤粺 + | + <% end%> ++ 鎴戠殑璇勫垎 + | +|||
---|---|---|---|---|---|---|---|---|---|---|---|
+
+
+ |
+
搴忓彿 | ++ | 浣滃搧鍚嶇О | <% if @homework.homework_type != 3 %> - -+ <%= link_to "濮撳悕",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl #{@homework.anonymous_comment == 1 ? 'ml35' : 'ml18'}" ,:remote => true%> + <% if @show_all && @order == "lastname"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%> + <% end%> + | ++ <%= link_to "瀛﹀彿",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml30" ,:remote => true%> + <% if @show_all && @order == "student_id"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%> + <% end%> + | <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> -+ 鍏宠仈椤圭洰 + | <% end %> - -+ <%= link_to "鏃堕棿",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%> + <% if @show_all && @order == "created_at"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> + | ++ <%= link_to "鏁欏笀",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10" ,:remote => true%> + <% if @show_all && @order == "teacher_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%> + <% end%> + | ++ <%= link_to "鏁欒緟",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "teaching_asistant_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> + | + <% if @homework.homework_type == 2%> ++ <%= link_to "绯荤粺",@show_all ? student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "system_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> + | <% end%> -+ <%= link_to "鍖胯瘎",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "student_score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> + | + <% end %> ++ <%= link_to "鎴愮哗",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%> + <% if @show_all && @order == "score"%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%> + <% end%> + | +
---|---|---|---|---|---|---|---|---|---|---|---|
+
+
+ |
+
<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>100} %>
<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54, :maxwordsnum=>100} %>
<%= count>0 ? "#{count}" : "0" %>鍥炲|<%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %>璧
diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index dab970cdf..4fbb55321 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -9,7 +9,7 @@ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>100} %>