diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index da71a8f7d..261c6218d 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -47,4 +47,14 @@ class Api::Pm::WeeklyIssuesController < ApplicationController render :json => data end + def group_issues + @enterprise_identifier = params[:enterprise_identifier] || '' + @all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) + @all_issues = @all_issues.where(pm_project_id: params[:pm_project_ids].split(",")) if params[:pm_project_ids].present? + @all_issues = @all_issues.where(pm_issue_type: params[:pm_issue_type].to_i) if params[:pm_issue_type].present? + @this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s) + @this_week_all_issues = @this_week_all_issues.order('created_on desc') + @this_week_all_issues = kaminari_paginate(@this_week_all_issues) + end + end \ No newline at end of file diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 1dcde236f..6f9be57c0 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -97,7 +97,8 @@ class Api::V1::Issues::ListService < ApplicationService end end - issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? + issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && [4,5].include?(pm_issue_type.to_i) + #pm相关 # root_id# -1 查一级目录 issues = if root_id.to_i == -1 diff --git a/app/views/api/pm/weekly_issues/group_issues.json.jbuilder b/app/views/api/pm/weekly_issues/group_issues.json.jbuilder new file mode 100644 index 000000000..b6c2a55b9 --- /dev/null +++ b/app/views/api/pm/weekly_issues/group_issues.json.jbuilder @@ -0,0 +1,4 @@ +json.total_count @this_week_all_issues.total_count +json.issues @this_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end \ No newline at end of file diff --git a/config/routes/api.rb b/config/routes/api.rb index e63473624..25f3b0ad8 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -5,6 +5,7 @@ defaults format: :json do collection do get :personal get :group + get :group_issues end end resources :dashboards,only: [:index] do