This commit is contained in:
Your Name 2016-06-24 18:47:54 +08:00
parent e5ad64831a
commit 537f152562
4 changed files with 27 additions and 9 deletions

View File

@ -48,6 +48,7 @@ class QualityAnalysisController < ApplicationController
@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, :sonar_version => version, :path => path, :branch => branch, :language => language)
else
qa.update_attribute(:sonar_version, version)
end
@ -58,8 +59,16 @@ class QualityAnalysisController < ApplicationController
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
# @results = JSON.parse(projects_date)
# arr = JSON.parse(projects_date).map {|m| m["nm"]}
# arr.map
else
@name_flag = false
@resource_id = params[:resource_id]

View File

@ -1,3 +1,7 @@
class QualityAnalysis < ActiveRecord::Base
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language
def user_rep_name
self.author_login+":"+self.rep_identifier
end
end

View File

@ -1,16 +1,16 @@
<div class="project_r_h">
<h2 class="project_h2">分析结果</h2>
</div>
<ul class="analysis-result-list">
<li class="analysis-result-name fl fontBlue2" >名称</li>
<li class="analysis-result-version fl fontBlue2" >版本</li>
<li class="analysis-result-loc fl fontBlue2" >分支</li>
<li class="analysis-result-debt fl fontBlue2" >语言</li>
<li class="analysis-result-time fl fontBlue2" >时间</li>
<div class="cl"></div>
</ul>
<% if @quality_analyses.count >0 %>
<% @quality_analyses.each do |qa| %>
<ul class="analysis-result-list">
<li class="analysis-result-name fl fontBlue2" >名称</li>
<li class="analysis-result-version fl fontBlue2" >版本</li>
<li class="analysis-result-loc fl fontBlue2" >分支</li>
<li class="analysis-result-debt fl fontBlue2" >语言</li>
<li class="analysis-result-time fl fontBlue2" >时间</li>
<div class="cl"></div>
</ul>
<ul class="analysis-result-list">
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.author_login+":"+qa.rep_identifier, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %></li>
<li class="analysis-result-version fl fontBlue2" title="版本">1.0</li>

View File

@ -0,0 +1,5 @@
class AddNameToQualityAnalyses < ActiveRecord::Migration
def change
add_column :quality_analyses, :language, :string
end
end