Merge pull request '燃烬图接口' (#250) from KingChan/forgeplus:pm_project_develop into pm_project_develop

This commit is contained in:
KingChan 2024-01-23 17:18:18 +08:00
commit c9b6484b66
4 changed files with 65 additions and 41 deletions

View File

@ -8,6 +8,26 @@ class Api::Pm::SprintIssuesController < Api::Pm::BaseController
render 'api/v1/issues/index'
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
pm_sprint_ids = params[:pm_sprint_ids].split(",") rescue []
return tip_exception '参数错误' if pm_sprint_ids.blank?

View File

@ -1,44 +1,46 @@
# == Schema Information
#
# Table name: attachments
#
# id :integer not null, primary key
# container_id :integer
# container_type :string(30)
# filename :string(255) default(""), not null
# disk_filename :string(255) default(""), not null
# filesize :integer default("0"), not null
# content_type :string(255) default("")
# digest :string(60) default(""), not null
# downloads :integer default("0"), not null
# author_id :integer default("0"), not null
# created_on :datetime
# description :text(65535)
# disk_directory :string(255)
# attachtype :integer default("1")
# is_public :integer default("1")
# copy_from :integer
# quotes :integer default("0")
# is_publish :integer default("1")
# publish_time :datetime
# resource_bank_id :integer
# unified_setting :boolean default("1")
# cloud_url :string(255) default("")
# course_second_category_id :integer default("0")
# delay_publish :boolean default("0")
# memo_image :boolean default("0")
# extra_type :integer default("0")
# uuid :string(255)
#
# Indexes
#
# index_attachments_on_author_id (author_id)
# index_attachments_on_container_id_and_container_type (container_id,container_type)
# index_attachments_on_course_second_category_id (course_second_category_id)
# index_attachments_on_created_on (created_on)
# index_attachments_on_is_public (is_public)
# index_attachments_on_quotes (quotes)
#
# == Schema Information
#
# Table name: attachments
#
# id :integer not null, primary key
# container_id :integer
# container_type :string(30)
# filename :string(255) default(""), not null
# disk_filename :string(255) default(""), not null
# filesize :integer default("0"), not null
# content_type :string(255) default("")
# digest :string(60) default(""), not null
# downloads :integer default("0"), not null
# author_id :integer default("0"), not null
# created_on :datetime
# description :text(65535)
# disk_directory :string(255)
# attachtype :integer default("1")
# is_public :integer default("1")
# copy_from :integer
# quotes :integer default("0")
# is_publish :integer default("1")
# publish_time :datetime
# resource_bank_id :integer
# unified_setting :boolean default("1")
# cloud_url :string(255) default("")
# course_second_category_id :integer default("0")
# delay_publish :boolean default("0")
# memo_image :boolean default("0")
# extra_type :integer default("0")
# uuid :string(255)
#
# Indexes
#
# index_attachments_on_author_id (author_id)
# index_attachments_on_container_id_and_container_type (container_id,container_type)
# index_attachments_on_course_second_category_id (course_second_category_id)
# index_attachments_on_created_on (created_on)
# index_attachments_on_is_public (is_public)
# index_attachments_on_quotes (quotes)
# index_attachments_on_uuid (uuid)
#

View File

@ -27,6 +27,7 @@
#
# index_journals_on_created_on (created_on)
# index_journals_on_journalized_id (journalized_id)
# index_journals_on_parent_id (parent_id)
# index_journals_on_review_id (review_id)
# index_journals_on_user_id (user_id)
# journals_journalized_id (journalized_id,journalized_type)

View File

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