diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 1d07863e1..8b24869e6 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -442,6 +442,45 @@ class IssuesController < ApplicationController JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id) end #flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? 去掉这个notice,因为现在更新都是ajax操作 + + # add by qiubing start + done_ratio = @issue.done_ratio + token = IssueToken.find_by_issues_id(@issue.id).tokens + + if done_ratio == 100 + if Integer(token) > 0 + g = Gitlab.client + gpid = Project.find(@issue.project_id).gpid + path_with_namespace = g.project(gpid).path_with_namespace + arr = path_with_namespace.split("/") + channelName = arr[0] + "-" + arr[1] + username = g.commit(Project.find(@issue.project_id).gpid,params[:commit_ids]).author_name + + Rails.logger.info("before executing minusToken command...") + # Rails.logger.info(pushTXInfoJson) + + require 'base64' + cmd = 'chain addToken '+channelName+' '+username+' '+token.to_s + Rails.logger.info(cmd) + puts cmd + + # result = system # 执行失败了 + output = StringIO.new + IO.popen(cmd) do |pipe| + pipe.each do |line| + Rails.logger.info(line) + end + end + Rails.logger.info(output.string) + # puts output.string + # Rails.logger.info(result) + Rails.logger.info("after executing minusToken command...") + + end + end + + # add by qiubing end + respond_to do |format| format.js format.html { redirect_to issue_url(@issue.id) } @@ -455,6 +494,7 @@ class IssuesController < ApplicationController format.api { render_validation_errors(@issue) } end end + end # 保存issue的时候相关的commit操作 diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 4f74cc08e..80e96c534 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -374,7 +374,7 @@ class PullRequestsController < ApplicationController Rails.logger.info(pushTXInfoJson) require 'base64' - cmd = 'fabricChain trustiePush '+owner_name+'-'+versionName+' ' + Base64.strict_encode64(pushTXInfoJson).to_s + cmd = 'chain trustiePush '+owner_name+'-'+versionName+' ' + Base64.strict_encode64(pushTXInfoJson).to_s Rails.logger.info(cmd) puts cmd diff --git a/app/views/issues/_project_issue.html.erb b/app/views/issues/_project_issue.html.erb index 2555abc9d..885054f16 100644 --- a/app/views/issues/_project_issue.html.erb +++ b/app/views/issues/_project_issue.html.erb @@ -68,6 +68,13 @@
  • <%= activity.fixed_version %>
  • <%= activity.status.name%>
  • <%= activity.done_ratio %>%
  • + + + +
  • <%=IssueToken.find_by_issues_id(activity.id).tokens %>
  • + + +
  • <% if activity.journals.count > 0 %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index aa51842aa..d1e30e2a5 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -306,6 +306,14 @@ {:include_blank => false, :selected => @test ? @test : 0 }, {:onchange => "remote_function();add_style();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> + + + <%= select(:issue, :test, [["升序",1],["降序",2]].unshift(["token",0]), + {:include_blank => false, :selected => @test ? @test : 0 }, + {:onchange => "remote_function();add_style();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> + + +