From c658296e2b8270a1e6fcbbc331b181df531faa59 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 24 Jun 2016 19:12:07 +0800 Subject: [PATCH] config --- .../quality_analysis_controller.rb | 43 ++++++++++--------- .../projects/_development_group.html.erb | 4 -- app/views/repositories/show.html.erb | 12 +++--- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index b14f024d7..83e5960b9 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -56,27 +56,28 @@ class QualityAnalysisController < ApplicationController def index @sonar_address = Redmine::Configuration['sonar_address'] - if params[:resource_id].nil? - @name_flag = true - @quality_analyses = QualityAnalysis.where(:project_id => @project.id) - # @quality_analyses.map {|qa| qa.} - # if @quality_analyses.count > 0 - # @quality_analyses.each do |qa| - # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] - # - # end - # end - # projects_date = open(@sonar_address + "/api/projects/index").read - # arr = JSON.parse(projects_date).map {|m| m["nm"]} - # arr.map - else - @name_flag = false - @resource_id = params[:resource_id] - complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read - @complexity =JSON.parse(complexity_date).first - issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read - @sonar_issues = JSON.parse(issue_date).first - end + # if params[:resource_id].nil? + # @name_flag = true + # @quality_analyses = QualityAnalysis.where(:project_id => @project.id) + # # @quality_analyses.map {|qa| qa.} + # # if @quality_analyses.count > 0 + # # @quality_analyses.each do |qa| + # # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] + # # + # # end + # # end + # # projects_date = open(@sonar_address + "/api/projects/index").read + # # arr = JSON.parse(projects_date).map {|m| m["nm"]} + # # arr.map + # else + qa = QualityAnalysis.where(:project_id => @project.id).first + @resource_id = qa.author_login+":"+qa.rep_identifier + @name_flag = false + complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read + @complexity =JSON.parse(complexity_date).first + issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read + @sonar_issues = JSON.parse(issue_date).first + # end end # Find project of id params[:project_id] diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index f3e1d0a1e..2c7d36fb5 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -56,10 +56,6 @@ <% end %> <% end %> - -