新增:批量更新迭代中工作项

This commit is contained in:
yystopf 2023-11-29 14:28:31 +08:00
parent 9c4bc3f37c
commit fe4f56dd36
2 changed files with 29 additions and 0 deletions

View File

@ -32,6 +32,34 @@ class Api::Pm::SprintIssuesController < Api::Pm::BaseController
end
render_ok(data: data)
end
before_action :load_uncomplete_issues, only: [:complete]
def complete
begin
case complete_params[:complete_type].to_i
when 1
@issues.update_all(status_id: 5)
when 2
@issues.update_all(pm_sprint_id: 0)
when 3
@issues.update_all(pm_sprint_id: complete_params[:target_pm_project_sprint_id])
end
render_ok
rescue => e
render_error(e.message)
end
end
private
def load_uncomplete_issues
@issues = Issue.where(pm_sprint_id: complete_params[:pm_project_sprint_id]).where.not(status_id: 5)
end
def complete_params
params.permit(:pm_project_sprint_id, :complete_type, :target_pm_project_sprint_id)
end
def query_params
params.permit(

View File

@ -24,6 +24,7 @@ defaults format: :json do
resources :sprint_issues, only: [:index] do
collection do
get :statistics
post :complete
end
end
resources :projects do