diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 852277126..a9b93269a 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -67,18 +67,18 @@ class QualityAnalysisController < ApplicationController puts e end # respond_to do |format| - # format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)} + # #format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)} # format.js # end end # get language type def swith_language_type language - if language = "c#" + if language == "c#" "cs" - elsif language = "python" + elsif language == "python" "py" - elsif language = "c" + elsif language == "c" "c++" else language diff --git a/app/views/quality_analysis/_hightchars.html.erb b/app/views/quality_analysis/_hightchars.html.erb index 278851ad5..9e6cdf5aa 100644 --- a/app/views/quality_analysis/_hightchars.html.erb +++ b/app/views/quality_analysis/_hightchars.html.erb @@ -94,7 +94,7 @@ }, series: [{ name: '代码质量', - data: [<%= @complexity["msr"][9]["val"] %>] + data: [<%= @complexity["msr"][9].nil? ? 0 : @complexity["msr"][9]["val"] %>] // tooltip: { // valueSuffix: ' km/h' // } diff --git a/app/views/quality_analysis/create.js.erb b/app/views/quality_analysis/create.js.erb deleted file mode 100644 index 8f93f86ee..000000000 --- a/app/views/quality_analysis/create.js.erb +++ /dev/null @@ -1 +0,0 @@ -alert("正在分析中…………(大概需要30分钟,请耐心等待)") \ No newline at end of file diff --git a/app/views/repositories/_quality_analysis.html.erb b/app/views/repositories/_quality_analysis.html.erb index b6eb62124..17af1b477 100644 --- a/app/views/repositories/_quality_analysis.html.erb +++ b/app/views/repositories/_quality_analysis.html.erb @@ -1,6 +1,6 @@
代码质量分析
- <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id, :remote => true), :id => 'quality_analyses_form') do %> + <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :remote => true, :id => 'quality_analyses_form') do %>
diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index b524e898f..112f3c4e5 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -6,7 +6,7 @@ <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %> <%# if User.current.member_of?(@project) %> <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %> + <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %> <% end %> <%# end %> <%# else %> diff --git a/config/routes.rb b/config/routes.rb index 52629604c..2a6204bbf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -928,6 +928,7 @@ RedmineApp::Application.routes.draw do } get 'projects/:id/repository/statistics', :to => 'repositories#stats' + get 'projects/:id/repository/quality_analysis', :to => 'repositories#quality_analysis' get 'projects/:id/repository/graph', :to => 'repositories#graph'