diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 152335dd8..45d5a0ebf 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -25,8 +25,8 @@ class QualityAnalysisController < ApplicationController language = params[:language] path = params[:path] identifier = params[:identifier] - qa = QualityAnalysis.where(:project_id => @project.id).first - version = qa.sonar_version + 1 + qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first + version = qa.nil? ? 1 : qa.sonar_version + 1 properties = "sonar.projectKey=#{user_name}:#{identifier} sonar.projectName=#{user_name}:#{identifier} sonar.projectVersion=#{version} @@ -47,9 +47,9 @@ class QualityAnalysisController < ApplicationController # genkins address @g.add_project_hook(@project.gpid, (jenkins_address + "/project/#{user_name}_#{identifier}")) if qa.nil? - QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :version => version) + QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :sonar_version => version, :path => path, :branch => branch, :language => language) else - qa.update_attribute(:version, version) + qa.update_attribute(:sonar_version, version) end end @@ -57,8 +57,9 @@ class QualityAnalysisController < ApplicationController @sonar_address = Redmine::Configuration['sonar_address'] if params[:resource_id].nil? @name_flag = true - projects_date = open(sonar_address + "/api/projects/index").read - @results = JSON.parse(projects_date) + @quality_analyses = QualityAnalysis.where(:project_id => @project.id) + # projects_date = open(@sonar_address + "/api/projects/index").read + # @results = JSON.parse(projects_date) else @name_flag = false @resource_id = params[:resource_id] diff --git a/app/models/quality_analysis.rb b/app/models/quality_analysis.rb index 09803467e..40a0d82e9 100644 --- a/app/models/quality_analysis.rb +++ b/app/models/quality_analysis.rb @@ -1,3 +1,3 @@ class QualityAnalysis < ActiveRecord::Base - attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version + attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier end diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 2c7d36fb5..298416fd1 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -56,6 +56,10 @@ <% end %> <% end %> + +