Skip to content

Commit

Permalink
chore: updated minor gems
Browse files Browse the repository at this point in the history
  • Loading branch information
celsoMartins committed Sep 15, 2023
1 parent 7a7d6b2 commit 9864ebe
Show file tree
Hide file tree
Showing 53 changed files with 128 additions and 1,424 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ GEM
net-smtp (0.3.3)
net-protocol
netrc (0.11.0)
newrelic_rpm (9.4.2)
newrelic_rpm (9.5.0)
nio4r (2.5.9)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
Expand Down Expand Up @@ -384,7 +384,7 @@ GEM
rubocop-performance (1.19.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.21.0)
rubocop-rails (2.21.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/slack_configurations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SlackConfigurationsController < AuthenticatedController
before_action :assign_slack_config, only: %i[edit update toggle_active destroy]

def index
@slack_configurations = SlackConfiguration.all.order(:created_at)
@slack_configurations = SlackConfiguration.order(:created_at)
end

def new
Expand All @@ -15,7 +15,7 @@ def new
end

def edit
@slack_configurations = SlackConfiguration.all.order(:created_at)
@slack_configurations = SlackConfiguration.order(:created_at)
assign_teams
assign_customers
assign_stages
Expand All @@ -41,7 +41,7 @@ def toggle_active
end

def update
@slack_configurations = SlackConfiguration.all.order(:created_at)
@slack_configurations = SlackConfiguration.order(:created_at)
read_stages_in_params

if @slack_configuration.update(slack_configuration_params.merge(stages_to_notify_transition: @stage_ids))
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/teams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def build_projects_lead_time_in_time_array(executing_projects)
def build_membership_lead_time_in_time_array(active_memberships)
@memberships_lead_time_in_time = []
array_of_dates = []
active_memberships.includes([:demands]).each do |membership|
active_memberships.includes([:demands]).find_each do |membership|
membership_lead_times_hash = compute_membership_lead_times(membership)
array_of_dates << membership_lead_times_hash[:membership_period]
@memberships_lead_time_in_time << membership_lead_times_hash[:membership_data]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class UsersController < AuthenticatedController

def admin_dashboard
@users_list = User.all.sort_by(&:full_name)
@companies_list = Company.all.order(:name)
@companies_list = Company.order(:name)
end

def activate_email_notifications
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/teams/team_member_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def member_effort_data

def member_effort_daily_data
accumulator = last_30_days_hash
object.demand_efforts.where('start_time_to_computation >= TIMESTAMP WITH TIME ZONE :date', date: member_effort_daily_interval.iso8601).each do |effort|
object.demand_efforts.where('start_time_to_computation >= TIMESTAMP WITH TIME ZONE :date', date: member_effort_daily_interval.iso8601).find_each do |effort|
accumulator[effort.start_time_to_computation.beginning_of_day.to_date.to_s] += effort.effort_value.round(2)
end
{ x_axis: accumulator.keys, y_axis: accumulator.values }
Expand Down
4 changes: 2 additions & 2 deletions app/services/slack/slack_notification_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ def notify_team_efficiency(slack_notifier, team, start_date, end_date, title, no
return if average_team_efficiency.blank?

members_efforts = average_team_efficiency[:members_efficiency].reject { |member_effort| member_effort.try(:[], :membership).try(:[], :hours_per_month).blank? && member_effort.try(:[], :membership).try(:[], :hours_per_month)&.zero? }

return if members_efforts.blank?

effort_text = title

members_efforts.each_with_index do |member, index|
effort_text += "• #{medal_of_honor(index)} #{member[:membership].team_member.name} | Demandas: #{member[:cards_count]} | Horas: #{number_with_precision(member[:effort_in_month])} | Capacidade: #{member[:membership][:hours_per_month]} #{notification_period == "month" ? "| Vl Hr: #{number_with_precision(member[:value_per_hour_performed])}" : ''}\n"
effort_text += "• #{medal_of_honor(index)} #{member[:membership].team_member.name} | Demandas: #{member[:cards_count]} | Horas: #{number_with_precision(member[:effort_in_month])} | Capacidade: #{member[:membership][:hours_per_month]} #{notification_period == 'month' ? "| Vl Hr: #{number_with_precision(member[:value_per_hour_performed])}" : ''}\n"
end

effort_info_block = { type: 'section', text: { type: 'mrkdwn', text: effort_text } }
Expand Down
3 changes: 1 addition & 2 deletions app/services/team_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def compute_memberships_realized_hours(team, start_date, end_date)
avg_hours_per_demand: membership.avg_hours_per_demand(start_date, end_date),
cards_count: membership.cards_count(start_date, end_date),
realized_money_in_month: membership.realized_money_in_period(start_date, end_date), member_capacity_value: membership.hours_per_month || 0,
value_per_hour_performed: calculate_hours_per_month(membership.monthly_payment, membership.effort_in_period(start_date, end_date))
}
value_per_hour_performed: calculate_hours_per_month(membership.monthly_payment, membership.effort_in_period(start_date, end_date)) }
end
efficiency_data = efficiency_data.sort_by { |member_ef| member_ef[:effort_in_month] }.reverse

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def change
t.decimal :total_monthly_payment
end

TeamMember.all.each do |member|
TeamMember.find_each do |member|
member.update(total_monthly_payment: member.monthly_payment + (member.hours_per_month * member.hour_value))
end

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20190212180057_add_slug_to_demands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def change
t.integer :company_id, index: true
end

Demand.all.each { |demand| demand.update(company_id: demand.project.company.id) }
Demand.find_each { |demand| demand.update(company_id: demand.project.company.id) }

change_column_null :demands, :company_id, false

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20190704193534_create_jira_product_configs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def up
end
add_foreign_key :jira_project_configs, :jira_product_configs, column: :jira_product_config_id

Jira::JiraProjectConfig.all.each do |project_config|
Jira::JiraProjectConfig.find_each do |project_config|
product_config = Jira::JiraProductConfig.where(jira_product_key: project_config.jira_project_key)&.first&.id
project_config.update(jira_product_config_id: product_config) if product_config.present?
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20190723195649_add_api_token_to_company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def change

add_index :companies, :api_token, unique: true

Company.all.each.map(&:save)
Company.find_each.map(&:save)

change_column_null :companies, :api_token, false
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20190806135316_create_memberships.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def up
add_foreign_key :memberships, :team_members, column: :team_member_id
add_foreign_key :memberships, :teams, column: :team_id

TeamMember.all.each do |member|
TeamMember.find_each do |member|
Membership.create(team_id: member.team_id, team_member_id: member.id)
member.update(name: "#{member.teams.first.name} | #{member.name}") unless member.valid?
member.update(company_id: Team.find_by(id: member.team_id).company_id)
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20190812154723_create_item_assignments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def change
t.datetime :finish_time
end

ItemAssignment.all.each do |assigment|
ItemAssignment.find_each do |assigment|
assigment.update(start_time: (Demand.find(assigment.demand_id).commitment_date || Demand.find(assigment.demand_id).created_date), finish_time: Demand.find(assigment.demand_id).end_date)
assigment.destroy unless assigment.valid?
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def up
t.date :end_date
end

Membership.all.each { |membership| membership.update(hours_per_month: membership.team_member.hours_per_month, start_date: membership.team_member.start_date, end_date: membership.team_member.end_date) }
Membership.find_each { |membership| membership.update(hours_per_month: membership.team_member.hours_per_month, start_date: membership.team_member.start_date, end_date: membership.team_member.end_date) }

memberships_start_date_nil = Membership.all.where(start_date: nil)
memberships_start_date_nil = Membership.where(start_date: nil)
team_members_start_date_nil = memberships_start_date_nil.where(start_date: nil).map(&:team_member)

memberships_start_date_nil.map(&:destroy)
Expand All @@ -28,7 +28,7 @@ def down

add_column :team_members, :hours_per_month, :integer

Membership.all.each { |membership| membership.team_member.update(hours_per_month: membership.hours_per_month) }
Membership.find_each { |membership| membership.team_member.update(hours_per_month: membership.hours_per_month) }

change_table :memberships, bulk: true do |t|
t.remove :hours_per_month
Expand Down
1 change: 0 additions & 1 deletion db/migrate/20200130181814_add_role_to_user_and_company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ def change
rename_table :companies_users, :user_company_roles

change_table :user_company_roles, bulk: true do |t|
t.integer :id, index: true, primary_key: true
t.integer :user_role, index: true, default: 0, null: false

t.date :start_date
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20200430140032_add_customer_to_demand.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def change

add_foreign_key :demands, :customers, columm: :customer_id

Customer.all.each do |customer|
Customer.find_each do |customer|
customer.exclusive_projects.each do |project|
project.demands.each do |demand|
demand.update(customer: project.customers.first)
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20200615173415_add_item_assignment_effort.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def up
end
add_foreign_key :item_assignments, :memberships, column: :membership_id

ItemAssignment.all.each do |item_assignment|
ItemAssignment.find_each do |item_assignment|
membership = Membership.where(team_member_id: item_assignment.team_member_id, team: item_assignment.demand.team).first_or_initialize

membership.update(start_date: Time.zone.today) unless membership.valid?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def change

change_column_null :flow_events, :project_id, true

FlowEvent.all.each { |event| event.update(company_id: event.project.company.id) }
FlowEvent.find_each { |event| event.update(company_id: event.project.company.id) }

change_column_null :flow_events, :company_id, false
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def change
add_column :products, :company_id, :integer
add_index :products, :company_id

Product.all.each do |product|
Product.find_each do |product|
company_id = Customer.find_by(id: product.customer_id).company_id
product.update(company_id: company_id)
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20221205155616_add_slug_to_product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AddSlugToProduct < ActiveRecord::Migration[7.0]
def change
add_column :products, :slug, :string

Product.all.each { |p| p.update(slug: p.name.parameterize) }
Product.find_each { |p| p.update(slug: p.name.parameterize) }

change_column_null :products, :slug, false
add_index :products, %i[company_id slug], unique: true
Expand Down
Loading

0 comments on commit 9864ebe

Please sign in to comment.