Merge pull request '燃烬图接口' (#250) from KingChan/forgeplus:pm_project_develop into pm_project_develop
This commit is contained in:
commit
c9b6484b66
|
@ -8,6 +8,26 @@ class Api::Pm::SprintIssuesController < Api::Pm::BaseController
|
||||||
render 'api/v1/issues/index'
|
render 'api/v1/issues/index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def burndown_charts
|
||||||
|
return tip_exception '参数错误' if params[:pm_sprint_id].blank? || params[:start_time].blank? || params[:end_time].blank?
|
||||||
|
@issues = Issue.where(pm_sprint_id: params[:pm_sprint_id])
|
||||||
|
start_time = Date.parse params[:start_time]
|
||||||
|
end_time = Date.parse params[:end_time]
|
||||||
|
x = (end_time - start_time).to_i + 1 #计算间隔时间 加上最后一天
|
||||||
|
data = {}
|
||||||
|
curren_issues = @issues.group(:status_id,:due_date).count
|
||||||
|
x.times do |time|
|
||||||
|
e_time = start_time + time
|
||||||
|
undone = curren_issues[[1,nil]].to_i + curren_issues[[1,e_time]].to_i + curren_issues[[2,e_time]].to_i + curren_issues[[3,e_time]].to_i
|
||||||
|
completed = curren_issues[[4,e_time]].to_i + curren_issues[[5,e_time]].to_i
|
||||||
|
data[e_time] = {
|
||||||
|
undone: undone,
|
||||||
|
completed:completed
|
||||||
|
}
|
||||||
|
end
|
||||||
|
render_ok(data: data)
|
||||||
|
end
|
||||||
|
|
||||||
def statistics
|
def statistics
|
||||||
pm_sprint_ids = params[:pm_sprint_ids].split(",") rescue []
|
pm_sprint_ids = params[:pm_sprint_ids].split(",") rescue []
|
||||||
return tip_exception '参数错误' if pm_sprint_ids.blank?
|
return tip_exception '参数错误' if pm_sprint_ids.blank?
|
||||||
|
|
|
@ -38,11 +38,13 @@
|
||||||
# index_attachments_on_created_on (created_on)
|
# index_attachments_on_created_on (created_on)
|
||||||
# index_attachments_on_is_public (is_public)
|
# index_attachments_on_is_public (is_public)
|
||||||
# index_attachments_on_quotes (quotes)
|
# index_attachments_on_quotes (quotes)
|
||||||
|
# index_attachments_on_uuid (uuid)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Attachment < ApplicationRecord
|
class Attachment < ApplicationRecord
|
||||||
include BaseModel
|
include BaseModel
|
||||||
include Publicable
|
include Publicable
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#
|
#
|
||||||
# index_journals_on_created_on (created_on)
|
# index_journals_on_created_on (created_on)
|
||||||
# index_journals_on_journalized_id (journalized_id)
|
# index_journals_on_journalized_id (journalized_id)
|
||||||
|
# index_journals_on_parent_id (parent_id)
|
||||||
# index_journals_on_review_id (review_id)
|
# index_journals_on_review_id (review_id)
|
||||||
# index_journals_on_user_id (user_id)
|
# index_journals_on_user_id (user_id)
|
||||||
# journals_journalized_id (journalized_id,journalized_type)
|
# journals_journalized_id (journalized_id,journalized_type)
|
||||||
|
|
|
@ -25,6 +25,7 @@ defaults format: :json do
|
||||||
resources :sprint_issues, only: [:index] do
|
resources :sprint_issues, only: [:index] do
|
||||||
collection do
|
collection do
|
||||||
get :statistics
|
get :statistics
|
||||||
|
get :burndown_charts
|
||||||
post :complete
|
post :complete
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue