diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index fa2c87f8c..7ec532d79 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -202,6 +202,11 @@ class AttachmentsController < ApplicationController end @attachment.save @newfiledense = filedense + end + if @project + + elsif @course + end respond_to do |format| format.js diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 70bce9566..988768414 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -325,7 +325,7 @@ class FilesController < ApplicationController @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] show_attachments @containers - get_attachment_for_tip(@all_attachments) + # get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -378,7 +378,7 @@ class FilesController < ApplicationController @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers - get_attachment_for_tip(@all_attachments) + # get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index d661350c6..97222f0bd 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -229,7 +229,7 @@ class MembersController < ApplicationController user_ids.each do |user_id| member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id) - role_ids = attrs.delete(:role_ids) + role_ids = params[:membership][:role_ids] #role = Role.find(params[:membership][:role_ids]) # 这里的判断只能通过角色名,可以弄成常量 if role_ids && role_ids.include?("10") diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 9fbe5bc3c..bcfb74241 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -248,10 +248,12 @@ class QualityAnalysisController < ApplicationController author_infos.each do |author_info| email = author_info.email changes = author_info.changes.to_i - user_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}&resolved=false").read - issue_count = JSON.parse(user_issues)["total"].to_i + unresolved_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}&resolved=false").read + unresolved_issue_count = JSON.parse(unresolved_issues)["total"].to_i + all_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}").read + all_issue_count = JSON.parse(all_issues)["total"].to_i ratio = (changes == 0 ? 0 : format("%0.4f",issue_count.to_f/changes.to_f)) - @user_quality_infos << {:email => email, :changes => changes, :issue_count => issue_count, :ratio => ratio} + @user_quality_infos << {:email => email, :changes => changes, :unresolved_issue_count => unresolved_issue_count, :ratio => ratio, :all_issue_count => all_issue_count} end # 按名称转换成hash键值对 diff --git a/app/models/member.rb b/app/models/member.rb index cb15e067b..bb336e936 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -52,6 +52,9 @@ class Member < ActiveRecord::Base ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id) new_role_ids = ids - role_ids + if (new_role_ids.include?(7) || new_role_ids.include?(9)) && role_ids.include?(10) + member_roles.where("role_id = 10").first.update_column('is_current', 0) + end # Add new roles if new_role_ids.include?(7) && new_role_ids.include?(10) member_roles << MemberRole.new(:role_id => 7) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 5291c2d06..b5a15bc1f 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -115,21 +115,22 @@
-

- <%= render :partial => "files/tip_attachment_count" %> + + + +

共有 <%= @all_attachments.count%> 个资源

+

+ <%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %>

-

- <%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %> -

-
- - -

私有资源:
仅对本班级成员可见

-

公共资源:
对所有用户可见

-
+ + + + + +
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index ebda40e6e..7504fbecb 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -85,9 +85,10 @@
-

- <%= render :partial => "files/tip_attachment_count" %> -

+ + + +

共有 <%= @all_attachments.count%> 个资源

<% if @order == "asc" %> 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  @@ -102,14 +103,14 @@

- <% if !User.current.member_of?(@project) && show_attachment_tip(@project.id, "Project") %> -
- - -

私有资源:
仅对本项目成员可见

-

公共资源:
对所有用户可见

-
- <% end %> + <%# if !User.current.member_of?(@project) && show_attachment_tip(@project.id, "Project") %> + + + + + + + <%# end %>
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %> diff --git a/app/views/files/search_tag_attachment.js.erb b/app/views/files/search_tag_attachment.js.erb index 8aaff5aa5..11d4ad297 100644 --- a/app/views/files/search_tag_attachment.js.erb +++ b/app/views/files/search_tag_attachment.js.erb @@ -3,6 +3,6 @@ $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% else %> $("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>"); - $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); +// $("#tip_attachment_count").html("<%#= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% end %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index ed54fcdce..472a18b02 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -1,6 +1,6 @@ <%# course_model %> -<%# course_file_num = visable_attachemnts_incourse(@course).count%> -<% course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %> +<% course_file_num = visable_attachemnts_incourse(@course).count%> +<%# course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% homework_num = visable_course_homework @course %> diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 2fda1e727..a21428f2f 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -133,7 +133,8 @@ @@ -144,12 +145,13 @@ diff --git a/db/schema.rb b/db/schema.rb index 1e20df076..34579a13a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160811084401) do +ActiveRecord::Schema.define(:version => 20160824073554) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1283,6 +1283,7 @@ ActiveRecord::Schema.define(:version => 20160811084401) do t.boolean "mail_notification", :default => false, :null => false t.integer "course_id", :default => -1 t.integer "course_group_id", :default => 0 + t.integer "is_collect", :default => 1 end add_index "members", ["project_id"], :name => "index_members_on_project_id" diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index ce2423c34..454fce294 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -498,9 +498,9 @@ a:hover.upload_btn_grey{background:#8a8a8a;} .image-cir {border-radius:50%;} .analysis-genral-icon {position:absolute; padding:1px 5px; display:inline-block; top:5px;} .contribute-list-avatar {width:80px; vertical-align:middle; text-align:center;} -.contribute-list-code {width:160px; vertical-align:middle; text-align:center;} -.contribute-list-problem {width:170px; vertical-align:middle; text-align:center;} -.contribute-list-rate {width:228px; vertical-align:middle; text-align:center;} +.contribute-list-code {width:130px; vertical-align:middle; text-align:center;} +.contribute-list-problem {width:130px; vertical-align:middle; text-align:center;} +.contribute-list-rate {width:168px; vertical-align:middle; text-align:center;} .contribute-list-height {height:80px;} .contribute-list-line-height {line-height:80px;} @@ -554,4 +554,4 @@ a:hover.upload_btn_grey{background:#8a8a8a;} .icons_project_favorite {background: url(/images/syllabus/sy_icons_star.png) 0px 0px no-repeat; width:20px; height:20px; display:block; float:left;} .icons_project_star{background: url(/images/syllabus/sy_icons_star.png) 0px -27px no-repeat; width:20px; height:20px; display:block; float:left;} .new_projectlist_more{ text-align:center;} -.new_projectlist_more a:hover{ color:#3b94d6;} +.new_projectlist_more a:hover{ color:#3b94d6;}