Updated

app/models/installation / complete.rb

A
36 lines of codes
3 methods
12.3 complexity/method
7 churn
36.86 complexity
0 duplications
# frozen_string_literal: true module Installation::Complete
  1. Installation::Complete has no descriptive comment
def complete_installation! return unless Installation.installation_flow? return unless register_completed_install completed! app_reload true end def register_completed_install
  1. Installation::Complete#register_completed_install has a flog score of 28
return false if Current.account.blank?
  1. Installation::Complete#register_completed_install calls 'Current.account' 5 times Locations: 0 1 2
user = self.user result_request = Faraday.post( "#{ENV.fetch('STORE_URL', 'https://store.woofedcrm.com')}/installations/complete", { user_details: { name: user.full_name, email: user.email,
  1. Installation::Complete#register_completed_install refers to 'user' more than self (maybe move it to another class?) Locations: 0 1
phone_number: user.phone, job_description: user.job_description },
  1. Installation::Complete#register_completed_install refers to 'user' more than self (maybe move it to another class?) Locations: 0 1
company_details: { name: Current.account.name, site_url: Current.account.site_url,
  1. Installation::Complete#register_completed_install calls 'Current.account' 5 times Locations: 0 1 2
segment: Current.account.segment, number_of_employees: Current.account.number_of_employees }
  1. Installation::Complete#register_completed_install calls 'Current.account' 5 times Locations: 0 1 2
}.to_json, { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{token}" } ) result_request.status == 200 end def app_reload load "#{Rails.root}/app/controllers/application_controller.rb" Rails.application.reload_routes! end end