|
|
|
@@ -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, :status_ids |
|
|
|
attr_reader :pm_project_id, :pm_sprint_id, :root_id, :pm_issue_type, :status_ids, :ids, :exclude_ids |
|
|
|
attr_accessor :queried_issues, :total_issues_count, :closed_issues_count, :opened_issues_count, :complete_issues_count |
|
|
|
|
|
|
|
validates :category, inclusion: { in: %w[all opened closed], message: '请输入正确的Category'} |
|
|
|
@@ -31,6 +31,8 @@ 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] |
|
|
|
@ids = params[:ids] |
|
|
|
@exclude_ids = params[:exclude_ids] |
|
|
|
@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 |
|
|
|
@@ -105,10 +107,10 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
issues = issues.where(status_id: status_ids) unless status_ids.blank? |
|
|
|
|
|
|
|
# ids |
|
|
|
issues = issues.where(id: params[:ids].to_s.split(",")) if params[:ids].present? |
|
|
|
issues = issues.where(id: ids.to_s.split(",")) if ids.present? |
|
|
|
|
|
|
|
# exclude_ids |
|
|
|
issues = issues.where.not(id: params[:exclude_ids].to_s.split(",")) if params[:exclude_ids].present? |
|
|
|
issues = issues.where.not(id: exclude_ids.to_s.split(",")) if exclude_ids.present? |
|
|
|
|
|
|
|
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) |
|
|
|
|