From e766adf087977677d67b22c7e998df97b58e4c23 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 12 Jul 2016 16:23:30 +0800 Subject: [PATCH 01/16] add delete to qa --- .../quality_analysis_controller.rb | 32 ++++++++++++++++--- .../quality_analysis/_result_list.html.erb | 13 ++++---- config/routes.rb | 3 +- lib/trustie/gitlab/helper.rb | 2 -- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index ae752f6b9..08ac4067f 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -2,7 +2,7 @@ class QualityAnalysisController < ApplicationController before_filter :find_project_by_project_id#, :except => [:getattachtype] before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job] before_filter :authorize - before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job, :index] + before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job, :index, :delete] layout "base_projects" include ApplicationHelper include QualityAnalysisHelper @@ -84,7 +84,7 @@ class QualityAnalysisController < ApplicationController end # sonar 缓冲,取数据 - sleep(5) + sleep(3) # 获取sonar output结果 console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"] @@ -152,11 +152,31 @@ class QualityAnalysisController < ApplicationController @gitlab_default_branch = @g.project(@project.gpid).default_branch end + # 删除的时候主要删除三方面数据:1/Trustie数据 2/jenkins数据 3/sonar数据 + # 如果只删除数据1,则新建的时候会有冲突 + def delete + begin + qa = QualityAnalysis.find(params[:id]) + rep_id = Repository.where(:project_id => @project.id, :identifier => qa.rep_identifier).first.try(:id) + job_name = "#{qa.author_login}-#{rep_id}" + logger.info("result: job_name ###################==>#{job_name}") + logger.info("result: @client.job ###################==>#{@client.job}") + + d_job = @client.job.delete(job_name) + logger.info("result: delete job ###################==>#{d_job}") + qa.delete + respond_to do |format| + format.html{redirect_to project_quality_analysis_path(:project_id => @project.id)} + end + rescue Exception => e + puts e + end + end + # 更新Jenkins job,主要包括相关配置文件参数的更新,Trustie平台数据的更新 def update_jenkins_job begin rep_id = Repository.where(:project_id => @project.id).first.try(:id) - logger.error("#############################===>666") sonar_name = @quality_analysis.sonar_name job_name = "#{@quality_analysis.author_login}-#{rep_id}" version = @quality_analysis.sonar_version @@ -223,7 +243,7 @@ class QualityAnalysisController < ApplicationController if key == "sqale_index" value = com["frmt_val"] else - value = com["val"].to_i + value = com["val"] end @ha.store(key,value) end @@ -260,9 +280,11 @@ class QualityAnalysisController < ApplicationController def connect_jenkins @gitlab_address = Redmine::Configuration['gitlab_address'] @jenkins_address = Redmine::Configuration['jenkins_address'] + jenkins_username = Redmine::Configuration['jenkins_username'] + jenkins_password = Redmine::Configuration['jenkins_password'] # connect jenkins - @client = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => "temp", :password => '123123') + @client = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password) rescue => e logger.error("failed to connect Jenkins ==> #{e}") end diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index 3e2a7d373..d27ef6812 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -10,7 +10,7 @@
  • 分支
  • 语言
  • 路径
  • -
  • 编辑
  • +
  • @@ -21,16 +21,17 @@ - <% if User.current.try(:login) == qa.author_login %> + <% if User.current.try(:login) == qa.author_login || User.current.admin? || is_project_manager?(User.current.id, @project.id) %>
  • - <%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %> + <%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %> / + <%=link_to "删除", delete_project_quality_analysi_path(qa, :project_id => @project.id), :method => "delete", :confirm => "删除会一并删除分析结果,确定删除吗?", :class => "fontBlue2" %>
  • - <% else %> -
  • 编辑
  • - <% end %> + <% end %>
    <% end %> +<% else %> + <%#= 数据为空时候界面,待完善 %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index a570fef55..fbb69af62 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -790,12 +790,13 @@ RedmineApp::Application.routes.draw do end end - resources :quality_analysis, :only => [:index, :create, :edit, :update] do + resources :quality_analysis, :only => [:index, :create, :edit, :update, :delete] do collection do end member do match 'update_jenkins_job' match 'edit' + match 'delete' match 'create' get 'error_list' end diff --git a/lib/trustie/gitlab/helper.rb b/lib/trustie/gitlab/helper.rb index c9cbcee26..615bb6ac3 100644 --- a/lib/trustie/gitlab/helper.rb +++ b/lib/trustie/gitlab/helper.rb @@ -60,8 +60,6 @@ module Trustie def get_gitlab_role m case m.roles.first.position - when 1,2 - GUEST when 5 REPORTER when 4 From 191261d3b873d0c7ef46b8bb1cc90f9a13516806 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 12 Jul 2016 17:30:29 +0800 Subject: [PATCH 02/16] each time to 10s --- app/controllers/quality_analysis_controller.rb | 7 +++---- app/views/quality_analysis/error_list.html.erb | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 08ac4067f..a7e421cdc 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -33,7 +33,6 @@ class QualityAnalysisController < ApplicationController 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 if @client.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank? - logger.info("88888888888888888888") aa = @client.job.delete("#{job_name}") quality_an.delete unless quality_an.blank? end @@ -71,12 +70,12 @@ class QualityAnalysisController < ApplicationController # 判断调用sonar分析是否成功 # 等待启动时间处理, 最长时间为30分钟 - for i in 0..60 do - sleep(30) + for i in 0..180 do + sleep(10) @current_build_status = @client.job.get_current_build_status("#{job_name}") if (@current_build_status == "success" || @current_build_status == "failure") break - if i == 60 + if i == 180 @build_console_result = false break end diff --git a/app/views/quality_analysis/error_list.html.erb b/app/views/quality_analysis/error_list.html.erb index 84f2777fa..138dc9c08 100644 --- a/app/views/quality_analysis/error_list.html.erb +++ b/app/views/quality_analysis/error_list.html.erb @@ -6,6 +6,6 @@ <% if @build_console_result == false %> 分析超时 <% else %> - <%= h @error_list.output %> + <%= h @error_list.try(:output).html_safe %> <% end %> \ No newline at end of file From 845f36c4f3fa379b8f8a27e60a1ea13988ad0ba1 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 13 Jul 2016 10:00:04 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E8=A7=A3=E5=86=B3z=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=97=B6=E5=80=99=E9=82=AE=E7=AE=B1=E4=B8=8D=E8=83=BD=E6=98=AF?= =?UTF-8?q?=E5=A4=A7=E5=86=99=E5=8A=A0=E4=B8=8B=E5=88=92=E7=BA=BF=E7=9A=84?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/account/login.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 23acabd1f..cfe9cd695 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -62,7 +62,7 @@ }); $mail.blur(function (event) { - if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){ + if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){ $('#mail_req').html( '邮件格式不对').show(); $mail_correct = false; return ; From ef931d14918e059a0c5bc9c736c97bbc5657ed2a Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 13 Jul 2016 12:07:27 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E7=BC=96=E8=BE=91issue=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=E5=9B=9E=E5=A4=8Dissue=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=88=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/_form.html.erb | 24 ------------------------ app/views/issues/add_journal.js.erb | 5 +++-- app/views/issues/show.html.erb | 6 +++++- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 8b313a2ef..e2b6a0a17 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -58,13 +58,6 @@
  • - <%# if @copy_from && @copy_from.attachments.any? %> - - - - - <%# end %> <% if @copy_from && !@copy_from.leaf? %>

    @@ -83,23 +76,6 @@ <%= render :partial => 'issues/attributes' %>

    - - - - - <%#= link_to "", -# {:controller => 'watchers', :action => 'new', :project_id => @issue.project}, -# :remote => true, -# :method => 'get', - :class => "pic_sch mt5 ml5" %> - - <%#= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript watchers_autocomplete_for_user_path(:user => @available_watchers, :format => 'js', :flag => 'ture') }')" %> - - - - - - <%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %> <% end %> 确定 diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 21519d5a1..838e2d83d 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,8 +1,9 @@ <% if @issue_id %> //issue详情中回复 $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); - $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') - sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%=@issue.class.name%>"); + $("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>') + $("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>') + sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>"); issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", "resizeType":0, diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 67bb4d59d..13642c0ca 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -15,7 +15,7 @@ } }); -
    +
    问题跟踪
    @@ -23,8 +23,12 @@
    +
    <%= render :partial => 'issues/detail'%> +
    +
    <%= render :partial => 'issues/edit'%> +
    From 61bf6604b1ffc8355cca02ef05a25d8b2d6a03e6 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 13 Jul 2016 12:23:28 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E8=A7=A3=E5=86=B3ajax=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=EF=BC=8Cissue=E7=8A=B6=E6=80=81=E9=80=89=E6=A1=86?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 1 + app/views/issues/_attributes.html.erb | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 44f0d15f4..73877ddc7 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -440,6 +440,7 @@ class IssuesController < ApplicationController jour.save update_user_activity(@issue.class,@issue.id) update_forge_activity(@issue.class,@issue.id) + @allowed_statuses = @issue.new_statuses_allowed_to(User.current) @user_activity_id = params[:user_activity_id] if params[:issue_id] diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index f0967843a..cb9b79c7c 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -4,15 +4,15 @@
    • - <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> + <%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> <%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }), {:no_label => true}, # ajax 刷新 #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", :class => "w150" %> - <% else %> - <%= h(@issue.status.name) %> - <% end %> + <%# else %> + <%#= h(@issue.status.name) %> + <%# end %>
    • From 9b59ca20de663cae04e9bb648036ee5721b8d0e1 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Jul 2016 10:39:54 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dissue=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=88=A0=E9=99=A4=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E7=BC=96=E8=BE=91=E4=BF=9D=E5=AD=98issue?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E7=99=BD=E8=89=B2=E6=A1=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 16 ++++++++-------- app/views/issues/_issue_replies.html.erb | 3 +-- app/views/issues/_issue_reply_ke_form.html.erb | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 73877ddc7..049842e37 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -432,12 +432,12 @@ class IssuesController < ApplicationController def add_journal if User.current.logged? - jour = Journal.new - jour.user_id = User.current.id - jour.notes = params[:notes] - jour.journalized = @issue - jour.save_attachments(params[:attachments]) - jour.save + @jour = Journal.new + @jour.user_id = User.current.id + @jour.notes = params[:notes] + @jour.journalized = @issue + @jour.save_attachments(params[:attachments]) + @jour.save update_user_activity(@issue.class,@issue.id) update_forge_activity(@issue.class,@issue.id) @allowed_statuses = @issue.new_statuses_allowed_to(User.current) @@ -493,7 +493,7 @@ class IssuesController < ApplicationController update_forge_activity(@issue.class,@issue.id) respond_to do |format| - format.js + format.html{redirect_to issue_url(@issue)} end end end @@ -503,7 +503,7 @@ class IssuesController < ApplicationController @issue = Issue.find(params[:id]) Journal.destroy(params[:journal_id]) respond_to do |format| - format.js + format.html{redirect_to issue_url(@issue)} end end diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index 7b5383c1e..4efef74b8 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -42,7 +42,6 @@ l(:button_delete), {:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>reply.id}, :method => :get, - :remote=>true, :class => 'fr newsGrey mr10', :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) @@ -73,7 +72,7 @@
      - <%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %> + <%= render :partial => 'attachments/issue_reply', :locals => {:container => @jour.nil? ? @issue : @jour} %>
      diff --git a/app/views/issues/_issue_reply_ke_form.html.erb b/app/views/issues/_issue_reply_ke_form.html.erb index 7fbb0d191..87b599aa3 100644 --- a/app/views/issues/_issue_reply_ke_form.html.erb +++ b/app/views/issues/_issue_reply_ke_form.html.erb @@ -7,7 +7,7 @@
      <% if User.current.logged? %>
      - <%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%> + <%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post") do |f|%> <%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%> From 00c414c34791823a4eb0c8a8648d5ec68d05da4d Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Jul 2016 11:14:05 +0800 Subject: [PATCH 07/16] =?UTF-8?q?issue=E5=9B=9E=E5=A4=8D=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/_issue_replies.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index 4efef74b8..c120ca1b9 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -74,7 +74,7 @@
      <%= render :partial => 'attachments/issue_reply', :locals => {:container => @jour.nil? ? @issue : @jour} %>
      - +
      <% end %> From 8c6fca87c9a7a937dd9e5c9a4f47adeb2c75339e Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Jul 2016 13:57:06 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=96=B0=E9=97=BB=E6=B7=BB=E5=8A=A0=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E6=93=8D=E4=BD=9C=EF=BC=8C=E6=89=80=E6=9C=89=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_project_news.html.erb | 19 +++++++++++++++++++ app/views/users/_project_message.html.erb | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 2d498e827..e751e16ae 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -32,6 +32,25 @@
      <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
      + <% if User.current.logged? %> +
      +
        +
      • + <% if User.current.logged? %> +
          +
        • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
        • +
        • + <%= link_to(l(:button_edit), {:controller => 'news', :action => 'edit', :id => activity}, :class => 'postOptionLink') if activity.author == User.current %> +
        • +
        • + <%= delete_link(news_path(activity), :data => {:confirm => l(:text_are_you_sure)}, :class => 'postOptionLink') if activity.author == User.current %> +
        • +
        + <% end %> +
      • +
      +
      + <% end %>
      diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index d1bb99296..00075dc8e 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -1,4 +1,4 @@ -
      +
      <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> @@ -46,7 +46,7 @@ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
      <% if User.current.logged? %> - <% end%> From 4e3a7e8df121102c4302e112c2c26ef2812492e8 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jul 2016 14:11:51 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E2=80=9C=E6=97=A5=E6=9C=9F=E2=80=9D--=E3=80=8B=E2=80=9C?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=97=A5=E6=AD=A2=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/settings/_new_versions.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/settings/_new_versions.html.erb b/app/views/projects/settings/_new_versions.html.erb index 557025eaa..68d35f9af 100644 --- a/app/views/projects/settings/_new_versions.html.erb +++ b/app/views/projects/settings/_new_versions.html.erb @@ -73,7 +73,7 @@
    • - + <%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>" fl" %> <%= calendar_for('version_effective_date') %>
    • From 87e1e0c4b106e6eb06477f4f88aad1f74d940764 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jul 2016 14:45:06 +0800 Subject: [PATCH 16/16] =?UTF-8?q?rake=E4=BB=BB=E5=8A=A1=EF=BC=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=90=8E=E8=8E=B7=E5=8F=96=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E6=8F=90=E4=BA=A4=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/update_homework.rake | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/tasks/update_homework.rake b/lib/tasks/update_homework.rake index d97004c8c..33bcc2231 100644 --- a/lib/tasks/update_homework.rake +++ b/lib/tasks/update_homework.rake @@ -15,11 +15,9 @@ namespace :update_homework do unless student_works.nil? student_works.each do |s| project = Project.find s.project_id - unless project.nil? && project.gpid.blank? + if !project.nil? && !project.gpid.blank? project_time=project.updated_on project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last - puts "the time is =========================> #{time}" - puts "the project_time is =========================> #{project_time}" if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S') #if format_time(time) < format_time(project_time) time = project_time @@ -31,9 +29,6 @@ namespace :update_homework do changesets = g.commits(project.gpid, :ref_name => default_branch) changesets_latest_coimmit = changesets[0] unless changesets[0].blank? - puts "the time is =========================> #{time}" - puts "the changesets_latest_coimmit is =========================> #{changesets_latest_coimmit.created_at}" - puts "the distance time is =========================> #{changesets_latest_coimmit.created_at.to_time > Time.now}" if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.to_time.strftime('%Y-%m-%d %H:%M:%S') #if format_time(time) < format_time(changesets_latest_coimmit.created_at) time = changesets_latest_coimmit.created_at.to_time