sonar最新触发时间获取

This commit is contained in:
huang 2016-08-14 10:29:52 +08:00
parent 1f4f03d8ed
commit ff592c106e
3 changed files with 6 additions and 6 deletions

View File

@ -33,11 +33,6 @@ class QualityAnalysisController < ApplicationController
projects_date = open(@sonar_address + "/api/projects/index").read
arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first
logger.info("###########################6666666666666")
logger.info("job_name is ###########################{job_name}")
logger.info("@client_jenkins is ###########################{@client_jenkins}")
logger.info("@client_jenkins job is ###########################{@client_jenkins.job}")
logger.info("@client_jenkins result is ###########################{@client_jenkins.job.exists?(job_name)}")
if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
aa = @client_jenkins.job.delete("#{job_name}")
quality_an.delete unless quality_an.blank?

View File

@ -1,6 +1,11 @@
# encoding: utf-8
module QualityAnalysisHelper
def sonar_time sonar_name
sonar = open(@sonar_address + "/api/resources/index?resource=#{sonar_name}&depth=0").read
sonar =JSON.parse(sonar).first
end
def sqale_rating_status val
arr = []
if val <= 5

View File

@ -21,7 +21,7 @@
<li class="analysis-result-version fl fontBlue2 hidden" title="<%= qa.branch %>"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2 hidden" title="<%= qa.language %>"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2 hidden" title="<%= qa.path %>"><%= qa.path %></li>
<li class="analysis-result-time fl fontBlue2 hidden" title="<%= qa.updated_at %>"><%= format_time(qa.updated_at) %></li>
<li class="analysis-result-time fl fontBlue2 hidden" title="<%= qa.updated_at %>"><%= format_time(sonar_time(qa)) %></li>
<% if User.current.try(:login) == qa.author_login || User.current.admin? || is_project_manager?(User.current.id, @project.id) %>
<li class="analysis-result-edit fl fontBlue2 hidden" title="<%= qa.path %>">
<%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %><span style="color: #888"> / </span>