forked from Gitlink/forgeplus
新增:plan_start_date和plan_end_date
This commit is contained in:
parent
38fca847e8
commit
c19ebe0f6a
|
|
@ -42,6 +42,8 @@
|
|||
# changer_id :integer
|
||||
# fake_id :integer
|
||||
# enterprise_identifier :string(255)
|
||||
# plan_start_date :date
|
||||
# plan_end_date :date
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
|
|
@ -62,6 +64,7 @@
|
|||
# issues_project_id (project_id)
|
||||
#
|
||||
|
||||
|
||||
class Issue < ApplicationRecord
|
||||
#issue_type 1为普通,2为悬赏
|
||||
belongs_to :project, counter_cache: true, touch: true, optional: true
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
include Api::V1::Issues::Concerns::Loadable
|
||||
|
||||
attr_reader :project, :current_user
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num, :root_subject
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :plan_start_date, :plan_end_date, :start_date, :due_date, :subject, :description, :blockchain_token_num, :root_subject
|
||||
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login
|
||||
attr_accessor :created_issue
|
||||
|
||||
|
|
@ -22,6 +22,8 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
@branch_name = params[:branch_name]
|
||||
@start_date = params[:start_date]
|
||||
@due_date = params[:due_date]
|
||||
@plan_start_date = params[:plan_start_date]
|
||||
@plan_end_date = params[:plan_end_date]
|
||||
@subject = params[:subject]
|
||||
@description = params[:description]
|
||||
@blockchain_token_num = params[:blockchain_token_num]
|
||||
|
|
@ -135,6 +137,8 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
issue_attributes.merge!({due_date: due_date}) if due_date.present?
|
||||
issue_attributes.merge!({branch_name: branch_name}) if branch_name.present?
|
||||
issue_attributes.merge!({blockchain_token_num: blockchain_token_num}) if blockchain_token_num.present?
|
||||
issue_attributes.merge!({plan_start_date: plan_start_date}) if plan_start_date.present?
|
||||
issue_attributes.merge!({plan_end_date: plan_end_date}) if plan_end_date.present?
|
||||
|
||||
issue_attributes
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class Api::V1::Issues::ListService < ApplicationService
|
|||
@function_type = params[:function_type]
|
||||
@identifier = params[:identifier]
|
||||
@status_ids = params[:status_ids].present? ? params[:status_ids].split(',') : []
|
||||
@pms_product_module_ids = params[:pms_product_module_ids].present?? params[:pms_product_module_ids].split(',') : []
|
||||
@pm_issue_types = params[:pm_issue_types].present? ? params[:pm_issue_types].split(',') : []
|
||||
@sort_direction = (params[:sort_direction].present? ? params[:sort_direction] : 'desc').downcase
|
||||
@participator = params[:participator_id].present? ? User.find_by_id(params[:participator_id]) : current_user
|
||||
|
|
@ -182,6 +183,11 @@ class Api::V1::Issues::ListService < ApplicationService
|
|||
issues = issues.joins(:requirement_issue_ext).where(requirement_issue_exts: {identifier: identifier})
|
||||
end
|
||||
|
||||
# pms_product_module_id
|
||||
if pms_product_module_ids.present?
|
||||
issues = issues.joins(:requirement_issue_ext).where(requirement_issue_exts: {pms_product_module_id: pms_product_module_ids})
|
||||
end
|
||||
|
||||
@closed_issues_count = issues.closed.distinct.size
|
||||
@opened_issues_count = issues.opened.distinct.size
|
||||
@complete_issues_count = issues.closed.distinct.size + issues.where(status_id: 3).distinct.size - issues.where(pm_issue_type: 3, status_id: 3).distinct.size
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
include Api::V1::Issues::Concerns::Loadable
|
||||
|
||||
attr_reader :project, :issue, :current_user, :operate_by
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :plan_start_date, :plan_end_date, :start_date, :due_date, :subject, :description, :blockchain_token_num
|
||||
attr_reader :target_pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :time_scale
|
||||
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :before_issue_tag_ids, :before_assigner_ids, :project_id
|
||||
attr_accessor :add_assigner_ids, :previous_issue_changes, :updated_issue, :atme_receivers
|
||||
|
|
@ -23,6 +23,8 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
@branch_name = params[:branch_name]
|
||||
@start_date = params[:start_date]
|
||||
@due_date = params[:due_date]
|
||||
@plan_start_date = params[:plan_start_date]
|
||||
@plan_end_date = params[:plan_end_date]
|
||||
@subject = params[:subject]
|
||||
@description = params[:description]
|
||||
@blockchain_token_num = params[:blockchain_token_num]
|
||||
|
|
@ -131,6 +133,8 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
@updated_issue.branch_name = branch_name unless branch_name.nil?
|
||||
@updated_issue.start_date = start_date unless start_date.nil?
|
||||
@updated_issue.due_date = due_date unless due_date.nil?
|
||||
@updated_issue.plan_start_date = plan_start_date unless plan_start_date.nil?
|
||||
@updated_issue.plan_end_date = plan_end_date unless plan_end_date.nil?
|
||||
@updated_issue.subject = subject if subject.present?
|
||||
@updated_issue.description = description unless description.nil?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
class AddPlanStartDateAndPlanEndDateToIssues < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :issues, :plan_start_date, :date
|
||||
add_column :issues, :plan_end_date, :date
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue