Skip to content

Commit

Permalink
chore: fixed rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
celsoMartins committed Sep 5, 2023
1 parent 53598b9 commit 7bf4e49
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/graphql/types/demand_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module Types
class DemandType < Types::BaseObject
field :class_of_service, String
field :commitment_date, GraphQL::Types::ISO8601DateTime, null: true
field :company, Types::CompanyType, null: false
field :class_of_service, String
field :cost_to_project, Float, null: true
field :created_date, GraphQL::Types::ISO8601DateTime, null: true
field :current_stage_name, String
Expand Down
12 changes: 6 additions & 6 deletions app/graphql/types/product_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

module Types
class ProductType < Types::BaseObject
field :company, Types::CompanyType, null: true
field :id, ID, null: false
field :latest_deliveries, [Types::DemandType], null: true
field :name, String, null: false
field :slug, String, null: false
field :demands, [Types::DemandType]
field :average_queue_time, Integer
field :average_speed, Float
field :average_touch_time, Integer
field :company, Types::CompanyType, null: true
field :created_demands_count, Integer
field :delivered_demands_count, Integer
field :demands, [Types::DemandType]
field :demands_blocks_count, Integer
field :discarded_demands_count, Integer
field :downstream_demands_count, Integer
field :flow_events, [Types::FlowEventType], null: true
field :id, ID, null: false
field :latest_deliveries, [Types::DemandType], null: true
field :leadtime_p65, Integer
field :leadtime_p80, Integer
field :leadtime_p95, Integer
field :memberships, [Types::Teams::MembershipType]
field :name, String, null: false
field :portfolio_units, [Types::PortfolioUnitType]
field :portfolio_units_count, Integer
field :remaining_backlog_count, Integer
field :risk_reviews, [Types::RiskReviewType]
field :slug, String, null: false
field :unscored_demands_count, Integer
field :upstream_demands_count, Integer

Expand Down
18 changes: 9 additions & 9 deletions app/graphql/types/risk_review_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

module Types
class RiskReviewType < Types::BaseObject
field :blocks_per_demand, Float
field :bug_percentage, Float
field :bugs_count, Integer
field :company, Types::CompanyType, null: false
field :created_at, GraphQL::Types::ISO8601DateTime, null: false
field :demands, [Types::DemandType]
field :demands_count, Integer
field :demands_lead_time_p80, Float
field :outlier_demands_count, Integer
field :outlier_demands_percentage, Float
field :bugs_count, Integer
field :bug_percentage, Float
field :demands, [Types::DemandType]
field :blocks_per_demand, Float
field :flow_events_count, Integer
field :events_per_demand, Float
field :project_broken_wip_count, Integer
field :created_at, GraphQL::Types::ISO8601DateTime, null: false
field :flow_events_count, Integer
field :id, ID, null: false
field :lead_time_outlier_limit, Float, null: false
field :meeting_date, GraphQL::Types::ISO8601Date, null: false
field :monthly_avg_blocked_time, [Float]
field :outlier_demands_count, Integer
field :outlier_demands_percentage, Float
field :product, Types::ProductType, null: false
field :project_broken_wip_count, Integer
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
field :weekly_avg_blocked_time, [Float]
end
Expand Down
14 changes: 4 additions & 10 deletions app/models/risk_review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,15 @@ class RiskReview < ApplicationRecord
delegate :name, to: :product, prefix: true
delegate :count, to: :bugs, prefix: true

def demands_count
demands.count
end
delegate :count, to: :demands, prefix: true

def project_broken_wip_count
demands.map { |demand| demand.project }.uniq.map { |project| project.project_broken_wip_logs.count }.compact.sum
demands.map(&:project).uniq.filter_map { |project| project.project_broken_wip_logs.count }.sum
end

def flow_events_count
flow_events.count
end
delegate :count, to: :flow_events, prefix: true

def outlier_demands_count
outlier_demands.count
end
delegate :count, to: :outlier_demands, prefix: true

def bugs
demands.bug
Expand Down
12 changes: 6 additions & 6 deletions spec/controllers/risk_reviews_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@
allow_any_instance_of(Demand).to(receive(:stage_at)).and_return(stage)
demand = Fabricate :demand
demand_block = Fabricate :demand_block, demand: demand

risk_review = Fabricate :risk_review, product: product, demands: [demand], demand_blocks: [demand_block]

get :show, params: { company_id: company, product_id: product, id: risk_review }

expect(response).to render_template 'spa-build/index'
end
end

context 'with data to blockings' do
let(:risk_review) { Fabricate :risk_review, product: product, weekly_avg_blocked_time: [2, 3, 5], monthly_avg_blocked_time: [1, 2] }

before { get :show, params: { company_id: company, product_id: product, id: risk_review } }

it 'instantiates a new Team Member and renders the template' do
expect(response).to render_template 'spa-build/index'
end
Expand Down
1 change: 0 additions & 1 deletion spec/graphql/types/query_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,6 @@
end
end


describe '#projects' do
let(:company) { Fabricate :company }

Expand Down

0 comments on commit 7bf4e49

Please sign in to comment.