|
|
|
@@ -2,7 +2,7 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
include ActiveModel::Model |
|
|
|
|
|
|
|
attr_reader :project, :only_name, :category, :participant_category, :keyword, :author_id, :issue_tag_ids |
|
|
|
attr_reader :begin_date, :end_date |
|
|
|
attr_reader :begin_date, :end_date, :update_begin_date, :update_end_date |
|
|
|
attr_reader :milestone_id, :assigner_id, :status_id, :priority_id, :sort_by, :sort_direction, :current_user |
|
|
|
attr_reader :pm_project_id, :pm_project_ids, :pm_sprint_id, :root_id, :pm_issue_type, :status_ids, :ids, :exclude_ids, :pm_issue_types |
|
|
|
attr_accessor :queried_issues, :total_issues_count, :closed_issues_count, :opened_issues_count, :complete_issues_count |
|
|
|
@@ -27,6 +27,8 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
@status_id = params[:status_id] |
|
|
|
@begin_date = params[:begin_date] |
|
|
|
@end_date = params[:end_date] |
|
|
|
@update_begin_date = params[:update_begin_date] |
|
|
|
@update_end_date = params[:update_end_date] |
|
|
|
@sort_by = params[:sort_by].present? ? params[:sort_by] : 'issues.updated_on' |
|
|
|
@pm_project_id = params[:pm_project_id] |
|
|
|
@pm_project_ids = params[:pm_project_ids] |
|
|
|
@@ -144,6 +146,10 @@ class Api::V1::Issues::ListService < ApplicationService |
|
|
|
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 |
|
|
|
|
|
|
|
if update_begin_date&.present? || update_end_date&.present? |
|
|
|
issues = issues.where('issues.updated_on between ? and ?', update_begin_date&.present? ? update_begin_date.to_time : Time.now.beginning_of_day, update_end_date&.present? ? update_end_date.to_time.end_of_day : Time.now.end_of_day) |
|
|
|
end |
|
|
|
|
|
|
|
# keyword |
|
|
|
issues = issues.ransack(id_or_project_issues_index_eq: keyword).result.or(issues.ransack(subject_or_description_cont: keyword).result) if keyword.present? |
|
|
|
|
|
|
|
|