Commit a3806d20 authored by Eulyeon Ko's avatar Eulyeon Ko

Apply backend reviewer suggestions

Revert the name ordinal_number back to sequence
Fix a mistake (remove .compact)
parent e558ef90
......@@ -11527,10 +11527,10 @@ Represents an iteration object.
| <a id="iterationid"></a>`id` | [`ID!`](#id) | ID of the iteration. |
| <a id="iterationiid"></a>`iid` | [`ID!`](#id) | Internal ID of the iteration. |
| <a id="iterationiterationcadence"></a>`iterationCadence` | [`IterationCadence!`](#iterationcadence) | Cadence of the iteration. |
| <a id="iterationordinalnumber"></a>`ordinalNumber` | [`Int!`](#int) | Ordinal number of the iteration. The number represents the iteration's numerical position when the cadence's iterations are sorted by the start and end date. The earliest starting and ending iteration is assigned 1. |
| <a id="iterationreport"></a>`report` | [`TimeboxReport`](#timeboxreport) | Historically accurate report about the timebox. |
| <a id="iterationscopedpath"></a>`scopedPath` | [`String`](#string) | Web path of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts. |
| <a id="iterationscopedurl"></a>`scopedUrl` | [`String`](#string) | Web URL of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts. |
| <a id="iterationsequence"></a>`sequence` | [`Int!`](#int) | Sequence number for the iteration when you sort the containing cadence's iterations by the start and end date. The earliest starting and ending iteration is assigned 1. |
| <a id="iterationstartdate"></a>`startDate` | [`Time`](#time) | Timestamp of the iteration start date. |
| <a id="iterationstate"></a>`state` | [`IterationState!`](#iterationstate) | State of the iteration. |
| <a id="iterationtitle"></a>`title` | [`String!`](#string) | Title of the iteration. |
......@@ -43,7 +43,7 @@ Example response:
{
"id": 53,
"iid": 13,
"ordinal_number": 1,
"sequence": 1,
"group_id": 5,
"title": "Iteration II",
"description": "Ipsum Lorem ipsum",
......
......@@ -17,8 +17,8 @@ module Types
field :iid, GraphQL::Types::ID, null: false,
description: 'Internal ID of the iteration.'
field :ordinal_number, GraphQL::Types::Int, method: :sequence, null: false,
description: "Ordinal number of the iteration. The number represents the iteration's numerical position when the cadence's iterations are sorted by the start and end date. The earliest starting and ending iteration is assigned 1."
field :sequence, GraphQL::Types::Int, null: false,
description: "Sequence number for the iteration when you sort the containing cadence's iterations by the start and end date. The earliest starting and ending iteration is assigned 1."
field :title, GraphQL::Types::String, null: false,
description: 'Title of the iteration.'
......
......@@ -4,7 +4,7 @@ module API
module Entities
class Iteration < Grape::Entity
expose :id, :iid
expose :sequence, as: :ordinal_number
expose :sequence
expose :project_id, if: -> (entity, options) { entity&.project_id }
expose :group_id, if: -> (entity, options) { entity&.group_id }
expose :title, :description
......
......@@ -9,7 +9,7 @@ RSpec.describe GitlabSchema.types['Iteration'] do
it 'has the expected fields' do
expected_fields = %w[
id iid ordinal_number title description state web_path web_url scoped_path scoped_url
id iid sequence title description state web_path web_url scoped_path scoped_url
due_date start_date created_at updated_at report iteration_cadence
]
......
......@@ -31,7 +31,7 @@ RSpec.describe API::Iterations do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.size).to eq(3)
expect(json_response.map { |i| i['id'] }).to contain_exactly(current_iteration.id, closed_iteration.id, ancestor_iteration.id)
expect(json_response.map { |i| i['ordinal_number'] }.compact).to contain_exactly(current_iteration.sequence, closed_iteration.sequence, ancestor_iteration.sequence)
expect(json_response.map { |i| i['sequence'] } ).to contain_exactly(current_iteration.sequence, closed_iteration.sequence, ancestor_iteration.sequence)
end
context 'filter by iteration state' do
......
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