|
|
|
@@ -4,7 +4,7 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
attr_reader :project, :only_name, :category, :participant_category, :keyword, :author_id, :issue_tag_ids |
|
|
|
attr_reader :begin_date, :end_date |
|
|
|
attr_reader :milestone_id, :assigner_id, :status_id, :sort_by, :sort_direction, :current_user |
|
|
|
attr_reader :pm_project_id, :pm_sprint_id, :root_id, :pm_issue_type |
|
|
|
attr_reader :pm_project_id, :pm_sprint_id, :root_id, :pm_issue_type, :status_ids |
|
|
|
attr_accessor :queried_issues, :total_issues_count, :closed_issues_count, :opened_issues_count |
|
|
|
|
|
|
|
validates :category, inclusion: { in: %w[all opened closed], message: '请输入正确的Category'} |
|
|
|
@@ -31,6 +31,7 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
@pm_sprint_id = params[:pm_sprint_id] |
|
|
|
@root_id = params[:root_id] |
|
|
|
@pm_issue_type = params[:pm_issue_type] |
|
|
|
@status_ids = params[:status_ids].present? ? params[:status_ids].split(',') : [] |
|
|
|
@sort_direction = (params[:sort_direction].present? ? params[:sort_direction] : 'desc').downcase |
|
|
|
@current_user = current_user |
|
|
|
end |
|
|
|
@@ -72,7 +73,7 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
#pm相关 |
|
|
|
# root_id |
|
|
|
if root_id.present? |
|
|
|
issues = issues.where(root_id: root_id).or(issues.where(id: root_id)) |
|
|
|
issues = issues.where(root_id: root_id) |
|
|
|
end |
|
|
|
|
|
|
|
# pm_issue_type |
|
|
|
@@ -90,6 +91,9 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
# status_id |
|
|
|
issues = issues.where(status_id: status_id) if status_id.present? && category != 'closed' |
|
|
|
|
|
|
|
# status_ids |
|
|
|
issues = issues.where(status_id: status_ids) unless status_ids.blank? |
|
|
|
|
|
|
|
if begin_date&.present? || end_date&.present? |
|
|
|
issues = issues.where('issues.created_on between ? and ?', begin_date&.present? ? begin_date.to_time : Time.now.beginning_of_day, end_date&.present? ? end_date.to_time.end_of_day : Time.now.end_of_day) |
|
|
|
end |
|
|
|
|