Commit d720a2ab authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove old GraphQL burnup time series endpoint

This endpoint was moved so that it's nested under `report` so this is no
longer needed
parent 897978e0
...@@ -11174,11 +11174,6 @@ enum IssueType { ...@@ -11174,11 +11174,6 @@ enum IssueType {
Represents an iteration object Represents an iteration object
""" """
type Iteration implements TimeboxReportInterface { type Iteration implements TimeboxReportInterface {
"""
Daily scope and completed totals for burnup charts
"""
burnupTimeSeries: [BurnupChartDailyTotals!]
""" """
Timestamp of iteration creation Timestamp of iteration creation
""" """
...@@ -13249,11 +13244,6 @@ type MetricsDashboardAnnotationEdge { ...@@ -13249,11 +13244,6 @@ type MetricsDashboardAnnotationEdge {
Represents a milestone Represents a milestone
""" """
type Milestone implements TimeboxReportInterface { type Milestone implements TimeboxReportInterface {
"""
Daily scope and completed totals for burnup charts
"""
burnupTimeSeries: [BurnupChartDailyTotals!]
""" """
Timestamp of milestone creation Timestamp of milestone creation
""" """
...@@ -20877,11 +20867,6 @@ type TimeboxReport { ...@@ -20877,11 +20867,6 @@ type TimeboxReport {
} }
interface TimeboxReportInterface { interface TimeboxReportInterface {
"""
Daily scope and completed totals for burnup charts
"""
burnupTimeSeries: [BurnupChartDailyTotals!]
""" """
Historically accurate report about the timebox Historically accurate report about the timebox
""" """
......
...@@ -30490,28 +30490,6 @@ ...@@ -30490,28 +30490,6 @@
"name": "Iteration", "name": "Iteration",
"description": "Represents an iteration object", "description": "Represents an iteration object",
"fields": [ "fields": [
{
"name": "burnupTimeSeries",
"description": "Daily scope and completed totals for burnup charts",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "BurnupChartDailyTotals",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "createdAt", "name": "createdAt",
"description": "Timestamp of iteration creation", "description": "Timestamp of iteration creation",
...@@ -36427,28 +36405,6 @@ ...@@ -36427,28 +36405,6 @@
"name": "Milestone", "name": "Milestone",
"description": "Represents a milestone", "description": "Represents a milestone",
"fields": [ "fields": [
{
"name": "burnupTimeSeries",
"description": "Daily scope and completed totals for burnup charts",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "BurnupChartDailyTotals",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "createdAt", "name": "createdAt",
"description": "Timestamp of milestone creation", "description": "Timestamp of milestone creation",
...@@ -60673,28 +60629,6 @@ ...@@ -60673,28 +60629,6 @@
"name": "TimeboxReportInterface", "name": "TimeboxReportInterface",
"description": null, "description": null,
"fields": [ "fields": [
{
"name": "burnupTimeSeries",
"description": "Daily scope and completed totals for burnup charts",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "BurnupChartDailyTotals",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "report", "name": "report",
"description": "Historically accurate report about the timebox", "description": "Historically accurate report about the timebox",
...@@ -1704,7 +1704,6 @@ Represents an iteration object. ...@@ -1704,7 +1704,6 @@ Represents an iteration object.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `burnupTimeSeries` | BurnupChartDailyTotals! => Array | Daily scope and completed totals for burnup charts |
| `createdAt` | Time! | Timestamp of iteration creation | | `createdAt` | Time! | Timestamp of iteration creation |
| `description` | String | Description of the iteration | | `description` | String | Description of the iteration |
| `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` | | `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` |
...@@ -2027,7 +2026,6 @@ Represents a milestone. ...@@ -2027,7 +2026,6 @@ Represents a milestone.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `burnupTimeSeries` | BurnupChartDailyTotals! => Array | Daily scope and completed totals for burnup charts |
| `createdAt` | Time! | Timestamp of milestone creation | | `createdAt` | Time! | Timestamp of milestone creation |
| `description` | String | Description of the milestone | | `description` | String | Description of the milestone |
| `dueDate` | Time | Timestamp of the milestone due date | | `dueDate` | Time | Timestamp of the milestone due date |
......
# frozen_string_literal: true
module Resolvers
class TimeboxBurnupTimeSeriesResolver < BaseResolver
type [Types::BurnupChartDailyTotalsType], null: true
alias_method :timebox, :synchronized_object
def resolve(*args)
return [] unless timebox.burnup_charts_available?
response = TimeboxReportService.new(timebox).execute
raise GraphQL::ExecutionError, response.message if response.error?
response.payload[:burnup_time_series]
end
end
end
...@@ -8,10 +8,5 @@ module Types ...@@ -8,10 +8,5 @@ module Types
resolver: ::Resolvers::TimeboxReportResolver, resolver: ::Resolvers::TimeboxReportResolver,
description: 'Historically accurate report about the timebox', description: 'Historically accurate report about the timebox',
complexity: 175 complexity: 175
field :burnup_time_series, [::Types::BurnupChartDailyTotalsType], null: true,
resolver: ::Resolvers::TimeboxBurnupTimeSeriesResolver,
description: 'Daily scope and completed totals for burnup charts',
complexity: 175
end end
end end
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['Milestone'] do RSpec.describe GitlabSchema.types['Milestone'] do
it 'has the expected fields' do it 'has the expected fields' do
expected_fields = %w[ expected_fields = %w[
report burnup_time_series report
] ]
expect(described_class).to have_graphql_fields(*expected_fields).at_least expect(described_class).to have_graphql_fields(*expected_fields).at_least
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Resolvers::TimeboxBurnupTimeSeriesResolver do
include GraphqlHelpers
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:issues) { create_list(:issue, 2, project: project) }
let_it_be(:start_date) { Date.today }
let_it_be(:due_date) { start_date + 2.weeks }
before do
stub_licensed_features(milestone_charts: true, issue_weights: true, iterations: true)
end
RSpec.shared_examples 'timebox time series' do
subject { resolve(described_class, obj: timebox) }
context 'when the feature flag is disabled' do
before do
stub_feature_flags(burnup_charts: false, iteration_charts: false)
end
it 'returns empty data' do
expect(subject).to be_empty
end
end
context 'when the feature flag is enabled' do
before do
stub_feature_flags(burnup_charts: true, iteration_charts: true)
end
it 'returns burnup chart data' do
expect(subject).to eq([
{
date: start_date + 4.days,
scope_count: 1,
scope_weight: 0,
completed_count: 0,
completed_weight: 0
},
{
date: start_date + 9.days,
scope_count: 2,
scope_weight: 0,
completed_count: 0,
completed_weight: 0
}
])
end
context 'when the service returns an error' do
before do
stub_const('TimeboxReportService::EVENT_COUNT_LIMIT', 1)
end
it 'raises a GraphQL exception' do
expect { subject }.to raise_error(GraphQL::ExecutionError, 'Burnup chart could not be generated due to too many events')
end
end
end
end
context 'when timebox is a milestone' do
let_it_be(:timebox) { create(:milestone, project: project, start_date: start_date, due_date: due_date) }
before_all do
create(:resource_milestone_event, issue: issues[0], milestone: timebox, action: :add, created_at: start_date + 4.days)
create(:resource_milestone_event, issue: issues[1], milestone: timebox, action: :add, created_at: start_date + 9.days)
end
it_behaves_like 'timebox time series'
end
context 'when timebox is an iteration' do
let_it_be(:timebox) { create(:iteration, group: group, start_date: start_date, due_date: due_date) }
before_all do
create(:resource_iteration_event, issue: issues[0], iteration: timebox, action: :add, created_at: start_date + 4.days)
create(:resource_iteration_event, issue: issues[1], iteration: timebox, action: :add, created_at: start_date + 9.days)
end
it_behaves_like 'timebox time series'
end
end
...@@ -10,7 +10,7 @@ RSpec.describe GitlabSchema.types['Iteration'] do ...@@ -10,7 +10,7 @@ RSpec.describe GitlabSchema.types['Iteration'] do
it 'has the expected fields' do it 'has the expected fields' do
expected_fields = %w[ expected_fields = %w[
id id title description state web_path web_url scoped_path scoped_url id id title description state web_path web_url scoped_path scoped_url
due_date start_date created_at updated_at report burnup_time_series due_date start_date created_at updated_at report
] ]
expect(described_class).to have_graphql_fields(*expected_fields).at_least expect(described_class).to have_graphql_fields(*expected_fields).at_least
......
...@@ -22,6 +22,7 @@ RSpec.describe 'Querying a Milestone' do ...@@ -22,6 +22,7 @@ RSpec.describe 'Querying a Milestone' do
context 'burnupTimeSeries' do context 'burnupTimeSeries' do
let(:fields) do let(:fields) do
<<~FIELDS <<~FIELDS
report {
burnupTimeSeries { burnupTimeSeries {
date date
scopeCount scopeCount
...@@ -29,6 +30,7 @@ RSpec.describe 'Querying a Milestone' do ...@@ -29,6 +30,7 @@ RSpec.describe 'Querying a Milestone' do
completedCount completedCount
completedWeight completedWeight
} }
}
FIELDS FIELDS
end end
...@@ -64,6 +66,7 @@ RSpec.describe 'Querying a Milestone' do ...@@ -64,6 +66,7 @@ RSpec.describe 'Querying a Milestone' do
post_graphql(query, current_user: current_user) post_graphql(query, current_user: current_user)
expect(subject).to eq({ expect(subject).to eq({
'report' => {
'burnupTimeSeries' => [ 'burnupTimeSeries' => [
{ {
'date' => '2020-01-05', 'date' => '2020-01-05',
...@@ -73,6 +76,7 @@ RSpec.describe 'Querying a Milestone' do ...@@ -73,6 +76,7 @@ RSpec.describe 'Querying a Milestone' do
'completedWeight' => 0 'completedWeight' => 0
} }
] ]
}
}) })
end end
end end
...@@ -87,7 +91,7 @@ RSpec.describe 'Querying a Milestone' do ...@@ -87,7 +91,7 @@ RSpec.describe 'Querying a Milestone' do
it 'returns empty results' do it 'returns empty results' do
post_graphql(query, current_user: current_user) post_graphql(query, current_user: current_user)
expect(subject).to eq({ 'burnupTimeSeries' => [] }) expect(subject).to eq({ 'report' => { 'burnupTimeSeries' => nil } })
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment