diff --git a/app/controllers/api/pm/sprint_issues_controller.rb b/app/controllers/api/pm/sprint_issues_controller.rb index e443fcc0c..9ee62d62c 100644 --- a/app/controllers/api/pm/sprint_issues_controller.rb +++ b/app/controllers/api/pm/sprint_issues_controller.rb @@ -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? diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 810474609..70e1cd03a 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -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) +# + diff --git a/app/models/journal.rb b/app/models/journal.rb index 2e754c51a..0fdca0f9d 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -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) diff --git a/config/routes/api.rb b/config/routes/api.rb index 50c6a9538..9ee877c2c 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -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