Skip to content

Commit

Permalink
add sprint to issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiomagalhaes committed May 14, 2024
1 parent ce32678 commit f842fe1
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'bootsnap', require: false

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
gem "image_processing", "~> 1.2"
gem 'image_processing', '~> 1.2'

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'
Expand Down
1 change: 1 addition & 0 deletions app/models/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# state :string
# title :string
# created_at :datetime not null
Expand Down
2 changes: 1 addition & 1 deletion app/services/issues_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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)
parent_tts_id: issue.parent_tts_id, board_column: issue.board_column, sprint: issue.sprint)
end.compact
end
rescue StandardError => e
Expand Down
13 changes: 10 additions & 3 deletions app/utils/clients/tts/azure/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ def url

def body(area_path)
{
'query' => 'SELECT [System.Id], [System.Title], [System.WorkItemType], [System.BoardColumn] ' \
'FROM workitems ' \
"WHERE [System.TeamProject] = '#{project_name}' AND [System.AreaPath] = '#{area_path}'"
'query' => "SELECT
[System.Id],
[System.Title],
[System.WorkItemType],
[System.BoardColumn],
[System.IterationPath]
FROM workitems
WHERE
[System.TeamProject] = '#{project_name}' AND
[System.AreaPath] = '#{area_path}'"
}
end

Expand Down
4 changes: 4 additions & 0 deletions app/utils/clients/tts/azure/parsers/ministry_brands_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def parent_tts_id
def board_column
json.dig('fields', 'System.BoardColumn')
end

def sprint
json.dig('fields', 'System.IterationPath')
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
Expand All @@ -19,7 +21,7 @@ def change
t.datetime :created_at, null: false
end

t.index [ :key ], unique: true
t.index [:key], unique: true
end

create_table :active_storage_attachments, id: primary_key_type do |t|
Expand All @@ -33,25 +35,26 @@ def change
t.datetime :created_at, null: false
end

t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
t.index %i[record_type record_id name blob_id], name: :index_active_storage_attachments_uniqueness, unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end

create_table :active_storage_variant_records, id: primary_key_type do |t|
t.belongs_to :blob, null: false, index: false, type: foreign_key_type
t.string :variation_digest, null: false

t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
t.index %i[blob_id variation_digest], name: :index_active_storage_variant_records_uniqueness, unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end

private
def primary_and_foreign_key_types
config = Rails.configuration.generators
setting = config.options[config.orm][:primary_key_type]
primary_key_type = setting || :primary_key
foreign_key_type = setting || :bigint
[primary_key_type, foreign_key_type]
end

def primary_and_foreign_key_types
config = Rails.configuration.generators
setting = config.options[config.orm][:primary_key_type]
primary_key_type = setting || :primary_key
foreign_key_type = setting || :bigint
[primary_key_type, foreign_key_type]
end
end
19 changes: 11 additions & 8 deletions db/migrate/20240411203958_create_action_text_tables.action_text.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This migration comes from action_text (originally 20180528164100)
class CreateActionTextTables < ActiveRecord::Migration[6.0]
def change
Expand All @@ -11,16 +13,17 @@ def change

t.timestamps

t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true
t.index %i[record_type record_id name], name: 'index_action_text_rich_texts_uniqueness', unique: true
end
end

private
def primary_and_foreign_key_types
config = Rails.configuration.generators
setting = config.options[config.orm][:primary_key_type]
primary_key_type = setting || :primary_key
foreign_key_type = setting || :bigint
[primary_key_type, foreign_key_type]
end

def primary_and_foreign_key_types
config = Rails.configuration.generators
setting = config.options[config.orm][:primary_key_type]
primary_key_type = setting || :primary_key
foreign_key_type = setting || :bigint
[primary_key_type, foreign_key_type]
end
end
7 changes: 7 additions & 0 deletions db/migrate/20240513143928_add_sprint_to_issues.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddSprintToIssues < ActiveRecord::Migration[7.0]
def change
add_column :issues, :sprint, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

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

1 change: 1 addition & 0 deletions spec/factories/issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# state :string
# title :string
# created_at :datetime not null
Expand Down
1 change: 1 addition & 0 deletions spec/models/issue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# effort :float
# issue_type :string
# reported_at :datetime
# sprint :string
# state :string
# title :string
# created_at :datetime not null
Expand Down

0 comments on commit f842fe1

Please sign in to comment.