Skip to content

Commit

Permalink
add start and end sprint date to issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiomagalhaes committed May 15, 2024
1 parent f842fe1 commit 412b155
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 56 deletions.
36 changes: 19 additions & 17 deletions app/models/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
#
# Table name: issues
#
# id :bigint not null, primary key
# board_column :string
# bug :boolean default(FALSE), not null
# closed_date :datetime
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# state :string
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# issue_id :string
# parent_tts_id :string
# project_id :bigint not null
# tts_id :string
# user_id :bigint
# id :bigint not null, primary key
# board_column :string
# bug :boolean default(FALSE), not null
# closed_date :datetime
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# sprint_end_date :datetime
# sprint_start_date :datetime
# state :string
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# issue_id :string
# parent_tts_id :string
# project_id :bigint not null
# tts_id :string
# user_id :bigint
#
# Indexes
#
Expand Down
3 changes: 2 additions & 1 deletion app/services/issues_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def call
Issue.create!(project: @project, effort: issue.effort, user: issue.user, state: issue.state,
closed_date: issue.closed_date, title: issue.title,
issue_type: issue.issue_type, reported_at: issue.reported_at, tts_id: issue.tts_id, bug: issue.bug?,
parent_tts_id: issue.parent_tts_id, board_column: issue.board_column, sprint: issue.sprint)
parent_tts_id: issue.parent_tts_id, board_column: issue.board_column, sprint: issue.sprint,
sprint_start_date: issue.sprint_start_date, sprint_end_date: issue.sprint_end_date)
end.compact
end
rescue StandardError => e
Expand Down
10 changes: 9 additions & 1 deletion app/utils/clients/tts/azure/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def list
end

parsed_items = work_items.map do |work_item|
parser.new(work_item, project)
parser.new(work_item, project, iteractions)
end

filtered_items(parsed_items)
Expand Down Expand Up @@ -65,6 +65,14 @@ def issues_urls
def project_name
project.metadata['azure_project_name']
end

def iteractions
return @iteractions if @iteractions

iterations_url = "#{customer_url}/#{project_name}/_apis/work/teamsettings/iterations?api-version=6.0"
response = ::Request.get(iterations_url, customer_authorization)
@iteractions = response['value']
end
end
end
end
Expand Down
5 changes: 3 additions & 2 deletions app/utils/clients/tts/azure/parsers/ministry_brands_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ module Tts
module Azure
module Parsers
class MinistryBrandsParser
attr_reader :json, :project
attr_reader :json, :project, :iterations

def initialize(json, project)
def initialize(json, project, iterations)
@json = json
@project = project
@iterations = iterations
end

def valid?
Expand Down
8 changes: 8 additions & 0 deletions db/migrate/20240515131152_add_sprints_data_to_issues.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class AddSprintsDataToIssues < ActiveRecord::Migration[7.0]
def change
add_column :issues, :sprint_start_date, :datetime
add_column :issues, :sprint_end_date, :datetime
end
end
4 changes: 3 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 19 additions & 17 deletions spec/factories/issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
#
# Table name: issues
#
# id :bigint not null, primary key
# board_column :string
# bug :boolean default(FALSE), not null
# closed_date :datetime
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# state :string
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# issue_id :string
# parent_tts_id :string
# project_id :bigint not null
# tts_id :string
# user_id :bigint
# id :bigint not null, primary key
# board_column :string
# bug :boolean default(FALSE), not null
# closed_date :datetime
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# sprint_end_date :datetime
# sprint_start_date :datetime
# state :string
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# issue_id :string
# parent_tts_id :string
# project_id :bigint not null
# tts_id :string
# user_id :bigint
#
# Indexes
#
Expand Down
36 changes: 19 additions & 17 deletions spec/models/issue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
#
# Table name: issues
#
# id :bigint not null, primary key
# board_column :string
# bug :boolean default(FALSE), not null
# closed_date :datetime
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# state :string
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# issue_id :string
# parent_tts_id :string
# project_id :bigint not null
# tts_id :string
# user_id :bigint
# id :bigint not null, primary key
# board_column :string
# bug :boolean default(FALSE), not null
# closed_date :datetime
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# sprint_end_date :datetime
# sprint_start_date :datetime
# state :string
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# issue_id :string
# parent_tts_id :string
# project_id :bigint not null
# tts_id :string
# user_id :bigint
#
# Indexes
#
Expand Down

0 comments on commit 412b155

Please sign in to comment.