From 3778871f587aecafbdbbfc3149845c06655893a3 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Aug 2016 10:39:16 +0800 Subject: [PATCH 1/7] =?UTF-8?q?issue=E5=9C=A8=E9=A1=B9=E7=9B=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E3=80=81=E5=88=97=E8=A1=A8=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E5=88=A0=E9=99=A4=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_news_replies.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index 1da4bc85e..fcbe59ebf 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -72,6 +72,7 @@ l(:button_delete), {:controller => 'issues',:action => 'delete_journal', :id => activity_id,:journal_id=>comment.id, :user_activity_id => user_activity_id}, :method => 'get', + :confirm => l(:text_are_you_sure), :remote=>true, :class => 'fr mr20', :title => l(:button_delete) From 61fe0fc77c6822faa16e97cfefc7372011c9ae67 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Aug 2016 10:50:18 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=8F=91=E5=B8=96=E6=97=B6=20=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=20=E5=86=85=E5=AE=B9=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/project.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 13ed76aa4..4d2c0c91a 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -607,11 +607,11 @@ function regexTopicDescription() $("#message_content_span").css('color','#ff0000'); return false; } - else if(name.length >=6000){ - $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)"); - $("#message_content_span").css('color','#ff0000'); - return false; - } +// else if(name.length >=6000){ +// $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)"); +// $("#message_content_span").css('color','#ff0000'); +// return false; +// } else { $("#message_content_span").text("填写正确"); @@ -621,11 +621,11 @@ function regexTopicDescription() } function submit_topic_project() { -// if(regexTopicSubject() && regexTopicDescription()) -// { + if(regexTopicSubject() && regexTopicDescription()) + { message_content_editor.sync(); $("#message-form-project").submit(); -// } + } } function reset_topic(){ From 60a76e64a5db01d5f8a31fe2485e6fa05cb7d726 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 26 Aug 2016 15:13:07 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality_analysis_controller.rb | 13 ++++ app/views/quality_analysis/_show.html.erb | 73 ++++++++----------- .../lib/gitlab/client/repositories.rb | 5 ++ 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index a0b275dc7..f0189a9b0 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -241,6 +241,19 @@ class QualityAnalysisController < ApplicationController complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read @complexity =JSON.parse(complexity_date).first + # 获取排名结果 + @g = Gitlab.client + author_infos = @g.rep_user_stats(@project.gpid, :rev => @branch) + @user_quality_infos = [] + 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 + ratio = (changes == 0 ? 0 : issue_count%changes) + @user_quality_infos << {:email => email, :changes => changes, :issue_count => issue_count, :ratio => ratio} + end + # 按名称转换成hash键值对 @ha = {} @complexity["msr"].each do |com| diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index f07225cc7..fc8146a02 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -127,46 +127,33 @@

<%= @ha["functions"].to_i %>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +<% unless @user_quality_infos.blank? %> +
贡献统计
+
+
    +
  •  
  • +
  • 代码行数
  • +
  • 引入质量问题数
  • +
  • 引入质量问题数/代码行数
  • +
    +
+ + <% @user_quality_infos.each do |author_info| %> + <% user = get_user_by_mail(author_info[:email]) %> +
    +
  • +
    + <%=link_to image_tag(url_to_avatar(user), :width => "50", :height => "30"), user_path(user), :class => "image-cir", :target => '_blank' %> + +
    +
  • +
  • <%= author_info[:changes] %>
  • +
  • <%= author_info[:issue_count] %>
  • +
  • <%= author_info[:ratio] %>
  • +
    +
+ <% end %> + +
+<% end %> + diff --git a/lib/gitlab-cli/lib/gitlab/client/repositories.rb b/lib/gitlab-cli/lib/gitlab/client/repositories.rb index e998ab56b..80d1058b5 100644 --- a/lib/gitlab-cli/lib/gitlab/client/repositories.rb +++ b/lib/gitlab-cli/lib/gitlab/client/repositories.rb @@ -117,6 +117,11 @@ class Gitlab::Client end alias_method :repo_rep_stats, :rep_stats + def rep_user_stats(project, options={}) + get("/projects/#{project}/repository/rep_user_stats", :query => options) + end + alias_method :repo_rep_stats, :rep_stats + # Gets a tree activities of project repository. # # @example From 3f7c6231637d01a689065f20b9d600a8102fc355 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 26 Aug 2016 15:57:45 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_file.html.erb | 10 ++++++++-- app/views/files/_project_file.html.erb | 10 ++++++++-- public/stylesheets/css/public.css | 7 ++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 946449680..f1f36d286 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -94,7 +94,7 @@

<% end %> -
+
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%> @@ -115,13 +115,19 @@
-

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

+

共有 <%= @all_attachments.count%> 个资源公共资源:1个私有资源:1个

<%= 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 40e5163a8..743ad34e8 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -65,7 +65,7 @@

<% end %> -
+
<%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> @@ -85,7 +85,7 @@
-

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

+

共有 <%= @all_attachments.count%> 个资源公共资源:1个私有资源:1个

<% 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"} %> /  @@ -100,6 +100,12 @@

+
+ + +

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

+

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

+
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %> diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index f9d344cf3..b19901016 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1418,4 +1418,9 @@ a:hover.comment_ding_link{ color:#269ac9;} } a.syllabusbox_a_blue{ color:#3b94d6 !important; -} \ No newline at end of file +} + +/*资源提示框*/ +.resource_tip_box {position:absolute; padding:5px 10px; white-space:nowrap; background-color:#fff; right:-150px; top:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} +.resource_tip_box em {display:block; border-width:10px; position:absolute;top:35px; left:-20px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;} +.resource_tip_box span {display:block; border-width:10px; position:absolute;top:35px; left:-18px; border-style:dashed solid dashed dashed; border-color:transparent #fff transparent transparent; font-size:0; line-height:0;} \ No newline at end of file From a71f948f41db784bc3d27a95a1894103f45223d6 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 26 Aug 2016 16:26:12 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E3=80=81=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E8=B5=84=E6=BA=90=E5=BA=93=E6=B7=BB=E5=8A=A0=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E8=B5=84=E6=BA=90=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 10 ++++++++++ app/views/files/_course_file.html.erb | 4 +++- app/views/files/_project_file.html.erb | 4 +++- app/views/files/_tip_attachment_count.html.erb | 3 +++ app/views/files/search_tag_attachment.js.erb | 1 + db/schema.rb | 8 +++++--- 6 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 app/views/files/_tip_attachment_count.html.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index cd3870e9a..9b12262af 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -325,6 +325,7 @@ class FilesController < ApplicationController @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] show_attachments @containers + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -377,6 +378,7 @@ class FilesController < ApplicationController @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -440,6 +442,13 @@ class FilesController < ApplicationController end + # 获取提示中私有、公开总数信息 + def get_attachment_for_tip all_attachment + @tip_all_attachments = all_attachment.count + @tip_all_public_attachments = all_attachment.select{|attach| attach.is_public == 1}.count + @tip_all_private_attachments = all_attachment.select{|attach| attach.is_public == 0}.count + end + def quote_resource_show @file = Attachment.find(params[:id]) @can_quote = attachment_candown @file @@ -883,6 +892,7 @@ class FilesController < ApplicationController end @all_attachments = @result + get_attachment_for_tip(@all_attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 946449680..0afe01ae2 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -115,7 +115,9 @@
-

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

+

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

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

diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index 40e5163a8..53cf4e15b 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -85,7 +85,9 @@
-

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

+

+ <%= render :partial => "files/tip_attachment_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"} %> /  diff --git a/app/views/files/_tip_attachment_count.html.erb b/app/views/files/_tip_attachment_count.html.erb new file mode 100644 index 000000000..35ef949a9 --- /dev/null +++ b/app/views/files/_tip_attachment_count.html.erb @@ -0,0 +1,3 @@ +共有 <%= @tip_all_attachments %> 个资源 +公共资源:<%= @tip_all_public_attachments %>个 +私有资源:<%= @tip_all_private_attachments %>个 \ No newline at end of file diff --git a/app/views/files/search_tag_attachment.js.erb b/app/views/files/search_tag_attachment.js.erb index dff75023b..8aaff5aa5 100644 --- a/app/views/files/search_tag_attachment.js.erb +++ b/app/views/files/search_tag_attachment.js.erb @@ -3,5 +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') %>"); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% end %> diff --git a/db/schema.rb b/db/schema.rb index 47b3bf210..1e20df076 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 => 20160810081337) do +ActiveRecord::Schema.define(:version => 20160811084401) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -2207,6 +2207,7 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "simi_id" t.integer "simi_value" t.integer "work_status", :default => 0 + t.datetime "commit_time" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -2510,8 +2511,9 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.string "remark" t.integer "groupid" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "bindtype", :default => 0 end create_table "users", :force => true do |t| From 420a17a7e442cc3374537bc4e99ff359a599d9f7 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 26 Aug 2016 17:34:17 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0=E5=AD=97=E5=8F=8A=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 30 +++++++++++++++++-- app/helpers/application_helper.rb | 5 ++++ app/views/files/_project_file.html.erb | 14 +++++---- .../files/_tip_attachment_count.html.erb | 14 ++++++++- app/views/layouts/base_courses.html.erb | 3 +- public/stylesheets/css/public.css | 2 +- 6 files changed, 57 insertions(+), 11 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 9b12262af..70bce9566 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -444,9 +444,35 @@ class FilesController < ApplicationController # 获取提示中私有、公开总数信息 def get_attachment_for_tip all_attachment - @tip_all_attachments = all_attachment.count + @tip_all_public_attachments = all_attachment.select{|attach| attach.is_public == 1}.count - @tip_all_private_attachments = all_attachment.select{|attach| attach.is_public == 0}.count + if params[:project_id] + if User.current.member_of?(@project) || User.current.admin? + @tip_all_attachments = all_attachment.count + @tip_all_private_attachments = all_attachment.select{|attach| attach.is_public == 0}.count + else + if params[:tag_name] + @tip_all_attachments = all_attachment.count + @tip_all_private_attachments = 0 + else + @tip_all_attachments = Attachment.where(:container_id => params[:project_id], :container_type => "Project").count + @tip_all_private_attachments = Attachment.where(:container_id => params[:project_id], :container_type => "Project", :is_public => 0).count + end + end + elsif params[:course_id] + if User.current.member_of_course?(@course) || User.current.admin? + @tip_all_attachments = all_attachment.count + @tip_all_private_attachments = all_attachment.select{|attach| attach.is_public == 0}.count + else + if params[:tag_name] + @tip_all_attachments = all_attachment.count + @tip_all_private_attachments = 0 + else + @tip_all_attachments = Attachment.where(:container_id => params[:course_id], :container_type => "Course").count + @tip_all_private_attachments = Attachment.where(:container_id => params[:course_id], :container_type => "Course", :is_public => 0).count + end + end + end end def quote_resource_show diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0c0e0919e..ffd30efc3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -820,6 +820,11 @@ module ApplicationHelper return @result end + def show_attachment_tip container_id, container_type + atts = Attachment.where(:container_id => container_id, :container_type => container_type, :is_public => 0) + atts.count > 0 ? true :false + end + # 必须是项目成,项目必须提交过代码 def allow_pull_request project return false if project.gpid.nil? diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index 7449ec8e2..ebda40e6e 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -102,12 +102,14 @@

-
- - -

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

-

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

-
+ <% 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/_tip_attachment_count.html.erb b/app/views/files/_tip_attachment_count.html.erb index 35ef949a9..b50e7bcaa 100644 --- a/app/views/files/_tip_attachment_count.html.erb +++ b/app/views/files/_tip_attachment_count.html.erb @@ -1,3 +1,15 @@ 共有 <%= @tip_all_attachments %> 个资源 公共资源:<%= @tip_all_public_attachments %>个 -私有资源:<%= @tip_all_private_attachments %>个 \ No newline at end of file +<% if @project %> + <% if !User.current.member_of?(@project) && params[:tag_name] %> + 私有资源:0个 + <% else %> + 私有资源:<%= @tip_all_private_attachments %>个 + <% end %> +<% elsif @course %> + <% if !User.current.member_of_course?(@course) && params[:tag_name] %> + 私有资源:0个 + <% else %> + 私有资源:<%= @tip_all_private_attachments %>个 + <% end %> +<% end %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 86a0a5518..027ef73e0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -1,5 +1,6 @@ <%# course_model %> -<% course_file_num = visable_attachemnts_incourse(@course).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/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index b19901016..663c9a69a 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -100,7 +100,7 @@ a.sendButtonBlue:hover {color:#ffffff;} a.resourcesTypeAll {background:url(../images/homepage_icon.png) -180px -89px no-repeat; padding-left:23px;} a.resourcesTypeAtt {background:url(../images/homepage_icon.png) -180px -49px no-repeat; padding-left:23px;} a.resourcesTypeUser {background:url(../images/homepage_icon.png) -178px -453px no-repeat; padding-left:23px;} -.resourcesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-90px; font-size:12px; color:#888888; display:none; line-height:2;} +.resourcesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-90px; font-size:12px; color:#888888; display:none; line-height:2;z-index: 999;} /*.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;}*/ /*.resourcesUploadBox:hover {background-color:#0781b4;}*/ From 9b86661f4ac4afd697864bce3705a17b4bb975c1 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 26 Aug 2016 17:49:31 +0800 Subject: [PATCH 7/7]
    --- .../quality_analysis_controller.rb | 2 +- app/views/quality_analysis/_show.html.erb | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index f0189a9b0..9fbe5bc3c 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -250,7 +250,7 @@ class QualityAnalysisController < ApplicationController 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 - ratio = (changes == 0 ? 0 : issue_count%changes) + 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} end diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index fc8146a02..2fda1e727 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -140,18 +140,20 @@ <% @user_quality_infos.each do |author_info| %> <% user = get_user_by_mail(author_info[:email]) %> -
      -
    • -
      - <%=link_to image_tag(url_to_avatar(user), :width => "50", :height => "30"), user_path(user), :class => "image-cir", :target => '_blank' %> - -
      -
    • -
    • <%= author_info[:changes] %>
    • -
    • <%= author_info[:issue_count] %>
    • -
    • <%= author_info[:ratio] %>
    • -
      -
    + <% unless author_info[:changes] == 0 %> +
      +
    • +
      + <%=link_to image_tag(url_to_avatar(user), :width => "50", :height => "30"), user_path(user), :class => "image-cir", :target => '_blank' %> + +
      +
    • +
    • <%= author_info[:changes] %>
    • +
    • <%= author_info[:issue_count] %>
    • +
    • <%= author_info[:ratio] %>
    • +
      +
    + <% end %> <% end %>