add accept issues function

This commit is contained in:
Nigel 2019-09-25 11:07:47 +08:00
parent fd3c6a1c36
commit 15ec9401aa
4 changed files with 56 additions and 1 deletions

View File

@ -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操作

View File

@ -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

View File

@ -68,6 +68,13 @@
<li class="c_grey issues_list_max" title="<%= activity.fixed_version %>"><%= activity.fixed_version %></li>
<li class="issues_list_min c_grey mr10" ><%= activity.status.name%></li>
<li class="<%= (activity.done_ratio == 100 ? 'c_green issues_list_min mr5' : 'c_red issues_list_min mr5') %>"><%= activity.done_ratio %>%</li>
<!-- add by qiubing start-->
<li class="issues_list_min c_red mr10" ><%=IssueToken.find_by_issues_id(activity.id).tokens %></li>
<!-- add by qiubing end-->
<li class="issues_list_min">
<% if activity.journals.count > 0 %>
<span class="issues_icons_mes fl mr5" style="margin-top:15px;" ></span>

View File

@ -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"}) %>
<!-- add by qiubing start-->
<%= 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"}) %>
<!-- add by qiubing end-->
</div>
<div class="cl"></div>
</div><!--issues_filter end-->