issue time_scale
This commit is contained in:
parent
a5da06b7b3
commit
289cb08ccd
|
@ -125,7 +125,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
|||
def issue_params
|
||||
params.permit(
|
||||
:status_id, :priority_id, :milestone_id,
|
||||
:branch_name, :start_date, :due_date,
|
||||
:branch_name, :start_date, :due_date, :time_scale,
|
||||
:subject, :description, :blockchain_token_num,
|
||||
:pm_project_id, :pm_sprint_id, :pm_issue_type, :parent_id,
|
||||
issue_tag_ids: [],
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
# pm_project_id :integer
|
||||
# pm_sprint_id :integer
|
||||
# pm_issue_type :integer
|
||||
# time_scale :decimal(10, 2) default("0.00")
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
|
|
|
@ -33,6 +33,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
@pm_sprint_id = params[:pm_sprint_id]
|
||||
@pm_issue_type = params[:pm_issue_type]
|
||||
@parent_id = params[:parent_id]
|
||||
@time_scale = params[:time_scale]
|
||||
end
|
||||
|
||||
def call
|
||||
|
@ -64,10 +65,11 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
@created_issue.pm_sprint_id = @pm_sprint_id
|
||||
@created_issue.pm_issue_type = @pm_issue_type
|
||||
@created_issue.parent_id = @parent_id
|
||||
@created_issue.time_scale = @time_scale
|
||||
@created_issue.issue_tags_value = @issue_tags.order("id asc").pluck(:id).join(",") unless issue_tag_ids.blank?
|
||||
@created_issue.save!
|
||||
|
||||
if Site.has_blockchain? && @project.use_blockchain
|
||||
if Site.has_blockchain? && @project.use_blockchain
|
||||
if @created_issue.blockchain_token_num.present? && @created_issue.blockchain_token_num > 0
|
||||
Blockchain::CreateIssue.call({user_id: current_user.id, project_id: @created_issue.project_id, token_num: @created_issue.blockchain_token_num})
|
||||
end
|
||||
|
|
|
@ -30,6 +30,11 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
@before_assigner_ids = issue.assigners.pluck(:id)
|
||||
@attachment_ids = params[:attachment_ids]
|
||||
@receivers_login = params[:receivers_login]
|
||||
@pm_project_id = params[:pm_project_id]
|
||||
@pm_sprint_id = params[:pm_sprint_id]
|
||||
@pm_issue_type = params[:pm_issue_type]
|
||||
@parent_id = params[:parent_id]
|
||||
@time_scale = params[:time_scale]
|
||||
@add_assigner_ids = []
|
||||
@previous_issue_changes = {}
|
||||
end
|
||||
|
@ -68,28 +73,34 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
@updated_issue.issue_tags_relates.destroy_all & @updated_issue.issue_tags = @issue_tags || IssueTag.none unless issue_tag_ids.nil?
|
||||
@updated_issue.issue_tags_value = @issue_tags.order("id asc").pluck(:id).join(",") unless issue_tag_ids.nil?
|
||||
|
||||
@created_issue.pm_project_id = @pm_project_id
|
||||
@created_issue.pm_sprint_id = @pm_sprint_id
|
||||
@created_issue.pm_issue_type = @pm_issue_type
|
||||
@created_issue.parent_id = @parent_id
|
||||
@created_issue.time_scale = @time_scale
|
||||
|
||||
@updated_issue.updated_on = Time.now
|
||||
@updated_issue.save!
|
||||
|
||||
build_after_issue_journal_details if @updated_issue.previous_changes.present? # 操作记录
|
||||
build_previous_issue_changes
|
||||
build_cirle_blockchain_token if blockchain_token_num.present?
|
||||
unless project.id.zero?
|
||||
# @信息发送
|
||||
AtmeService.call(current_user, @atme_receivers, @issue) unless receivers_login.blank?
|
||||
# 消息发送
|
||||
if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('IssueChanged', current_user.id, @issue&.id, previous_issue_changes) unless previous_issue_changes.blank?
|
||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id, add_assigner_ids) unless add_assigner_ids.blank?
|
||||
end
|
||||
|
||||
# @信息发送
|
||||
AtmeService.call(current_user, @atme_receivers, @issue) unless receivers_login.blank?
|
||||
# 消息发送
|
||||
if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('IssueChanged', current_user.id, @issue&.id, previous_issue_changes) unless previous_issue_changes.blank?
|
||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id, add_assigner_ids) unless add_assigner_ids.blank?
|
||||
unlock("Api::V1::Issues::UpdateService:#{project.id}:#{issue.id}")
|
||||
# 触发webhook
|
||||
Rails.logger.info "################### 触发webhook"
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueUpdate', @updated_issue&.id, current_user.id, previous_issue_changes.except(:issue_tags_value, :assigned_to_id))
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueLabel', @issue&.id, current_user.id, {issue_tag_ids: [before_issue_tag_ids, issue_tag_ids]}) unless issue_tag_ids.nil?
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueAssign', @issue&.id, current_user.id, {assigner_ids: [before_assigner_ids, assigner_ids]}) unless assigner_ids.nil?
|
||||
end
|
||||
|
||||
unlock("Api::V1::Issues::UpdateService:#{project.id}:#{issue.id}")
|
||||
# 触发webhook
|
||||
Rails.logger.info "################### 触发webhook"
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueUpdate', @updated_issue&.id, current_user.id, previous_issue_changes.except(:issue_tags_value, :assigned_to_id))
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueLabel', @issue&.id, current_user.id, {issue_tag_ids: [before_issue_tag_ids, issue_tag_ids]}) unless issue_tag_ids.nil?
|
||||
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueAssign', @issue&.id, current_user.id, {assigner_ids: [before_assigner_ids, assigner_ids]}) unless assigner_ids.nil?
|
||||
|
||||
return @updated_issue
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,3 +49,4 @@ json.parent_id issue.parent_id
|
|||
json.pm_issue_type issue.pm_issue_type
|
||||
json.pm_sprint_id issue.pm_sprint_id
|
||||
json.pm_project_id issue.pm_project_id
|
||||
json.time_scale issue.time_scale
|
|
@ -0,0 +1,5 @@
|
|||
class AddHourToIssues < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :issues, :time_scale, :decimal, precision: 10, scale: 2, default: 0.00
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue