里程碑添加参数

dev_forge
sylor_huang@126.com 5 years ago
parent 8d7b7cc71e
commit 516f9bab6c

@ -329,7 +329,7 @@ class ApplicationController < ActionController::Base
def current_user
# User.current
if Rails.env.development?
user_id = 50207
user_id = 36390
else
user_id = 130328
end

@ -314,15 +314,17 @@ class IssuesController < ApplicationController
type = params[:status_id].to_i || 5
if type == 5
message = "关闭"
old_message = "重新开启"
else
message = "重新开启"
old_message = "关闭"
end
if @issue.update_attribute(:status_id, type)
if type == 5
@issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "close")
@issue.issue_times.update_all(end_time: Time.now)
end
@issue.create_journal_detail(false, [], [])
@issue.custom_journal_detail("close_issue",old_message, "#{message}")
normal_status(0, message)
else
normal_status(-1, "操作失败")

@ -6,7 +6,7 @@ class Issue < ApplicationRecord
has_one :pull_request
# belongs_to :issue_tag,optional: true
belongs_to :priority, :class_name => 'IssuePriority', foreign_key: :priority_id,optional: true
belongs_to :version, foreign_key: :fixed_version_id,optional: true
belongs_to :version, foreign_key: :fixed_version_id,optional: true, counter_cache: true
belongs_to :user,optional: true, foreign_key: :author_id
belongs_to :issue_status, foreign_key: :status_id,optional: true
has_many :commit_issues
@ -23,6 +23,8 @@ class Issue < ApplicationRecord
scope :issue_issue, ->{where(issue_classify: [nil,"issue"])}
scope :issue_pull_request, ->{where(issue_classify: "pull_request")}
after_save :change_versions_count
def get_assign_user
User.select(:login, :lastname,:firstname, :nickname)&.find_by_id(self.assigned_to_id)
@ -87,4 +89,11 @@ class Issue < ApplicationRecord
journals.where.not(notes: [nil, ""]).journal_includes.limit(2)
end
def change_versions_count
if version.present? && self.status_id == 5
percent = version.issues_count == 0 ? 0.0 : ((version.closed_issues_count + 1) / version.issues_count)
version.update_attributes(closed_issues_count: (version.closed_issues_count + 1), percent: percent)
end
end
end

@ -5,13 +5,13 @@ class Version < ApplicationRecord
scope :version_includes, ->{includes(:issues, :user)}
def open_issues_count
issues.select(:id,:status_id).where(status_id: [1,2,3,4,6]).size
end
def close_issues_count
issues.select(:id,:status_id).where(status_id: 5).size
end
# def open_issues_count
# issues.select(:id,:status_id).where(status_id: [1,2,3,4,6]).size
# end
#
# def close_issues_count
# issues.select(:id,:status_id).where(status_id: 5).size
# end
def version_user
User.select(:login, :lastname,:firstname, :nickname)&.find_by_id(self.user_id)

@ -6,8 +6,8 @@ json.versions do
json.array! @versions.each.to_a do |version|
json.extract! version, :id, :name, :description, :effective_date,:status
json.open_issues_count version.open_issues_count
json.close_issues_count version.close_issues_count
json.open_issues_count (version.issues_count - version.closed_issues_count)
json.close_issues_count version.closed_issues_count
json.created_at format_time(version.created_on)
json.updated_at format_time(version.updated_on)
json.user_name version.version_user.try(:show_real_name)

@ -56,3 +56,4 @@ zh-CN:
issue_tag_ids: 标签
issue_type: 分类
token: 悬赏金额
close_issue: 了工单

@ -0,0 +1,7 @@
class AddIssuesCountToVersions < ActiveRecord::Migration[5.2]
def change
add_column :versions, :issues_count, :integer, :default => 0
add_column :versions, :closed_issues_count, :integer, :default => 0
add_column :versions, :percent, :float, default: 0.0
end
end

@ -45,7 +45,7 @@ export function initAxiosInterceptors(props) {
// https://github.com/axios/axios/issues/1497
// TODO 读取到package.json中的配置
var //proxy = "http://localhost:3000"
var proxy = "http://localhost:3000"
//proxy = "http://testbdweb.trustie.net"
//proxy = "http://testbdweb.educoder.net"
// proxy = "https://testeduplus2.educoder.net"
@ -54,7 +54,7 @@ export function initAxiosInterceptors(props) {
// proxy="https://test-newweb.educoder.net"
//proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001"
proxy="http://123.59.135.93:56666"
// proxy="http://123.59.135.93:56666"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制

Loading…
Cancel
Save