diff --git a/app/models/retainer_contract_model.rb b/app/models/retainer_contract_model.rb index 5d34405..aee80d6 100644 --- a/app/models/retainer_contract_model.rb +++ b/app/models/retainer_contract_model.rb @@ -6,7 +6,7 @@ # # id :bigint not null, primary key # charge_upfront :boolean default(FALSE), not null -# expected_hours_per_period :float +# expected_hours_per_period :float default(0.0) # revenue_per_period :float # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/user.rb b/app/models/user.rb index b2164cf..bf7e5d7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -23,7 +23,6 @@ # Indexes # # index_users_on_email (email) UNIQUE -# index_users_on_google_id (google_id) UNIQUE # index_users_on_profession_id (profession_id) # index_users_on_slug (slug) UNIQUE # diff --git a/app/utils/analytics/finances/calculators/retainer_calculator.rb b/app/utils/analytics/finances/calculators/retainer_calculator.rb index 1e3114f..083ed60 100644 --- a/app/utils/analytics/finances/calculators/retainer_calculator.rb +++ b/app/utils/analytics/finances/calculators/retainer_calculator.rb @@ -35,7 +35,7 @@ def assigned_expected_income(_assignment) def expected_hours(assignment) statement_of_work_total_hours = assignment.requirement.statement_of_work.contract_model.expected_hours_per_period - return super if statement_of_work_total_hours.nil? + return super if statement_of_work_total_hours.nil? || statement_of_work_total_hours.zero? statement_of_work_total_hours * assignment.coverage end diff --git a/db/migrate/20240125200817_remove_index_users_on_google_id.rb b/db/migrate/20240125200817_remove_index_users_on_google_id.rb new file mode 100644 index 0000000..6649331 --- /dev/null +++ b/db/migrate/20240125200817_remove_index_users_on_google_id.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class RemoveIndexUsersOnGoogleId < ActiveRecord::Migration[7.0] + def change + remove_index :users, column: :google_id, name: :index_users_on_google_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 666891c..feca593 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,8 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_01_25_134919) do +ActiveRecord::Schema[7.0].define(version: 2024_01_25_200817) do # These are extensions that must be enabled in order to support this database - enable_extension "pg_stat_statements" enable_extension "plpgsql" create_table "assignments", force: :cascade do |t| @@ -147,7 +146,7 @@ t.float "revenue_per_period" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.float "expected_hours_per_period" + t.float "expected_hours_per_period", default: 0.0 end create_table "salaries", force: :cascade do |t| @@ -283,7 +282,6 @@ t.string "country" t.boolean "internal", default: true, null: false t.index ["email"], name: "index_users_on_email", unique: true - t.index ["google_id"], name: "index_users_on_google_id", unique: true t.index ["profession_id"], name: "index_users_on_profession_id" t.index ["slug"], name: "index_users_on_slug", unique: true end diff --git a/spec/factories/retainer_contract_models.rb b/spec/factories/retainer_contract_models.rb index 3e6098e..baceb51 100644 --- a/spec/factories/retainer_contract_models.rb +++ b/spec/factories/retainer_contract_models.rb @@ -6,7 +6,7 @@ # # id :bigint not null, primary key # charge_upfront :boolean default(FALSE), not null -# expected_hours_per_period :float +# expected_hours_per_period :float default(0.0) # revenue_per_period :float # created_at :datetime not null # updated_at :datetime not null diff --git a/spec/factories/users.rb b/spec/factories/users.rb index f35a58c..1353380 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -23,7 +23,6 @@ # Indexes # # index_users_on_email (email) UNIQUE -# index_users_on_google_id (google_id) UNIQUE # index_users_on_profession_id (profession_id) # index_users_on_slug (slug) UNIQUE # diff --git a/spec/models/retainer_contract_model_spec.rb b/spec/models/retainer_contract_model_spec.rb index e7bf3a4..681d083 100644 --- a/spec/models/retainer_contract_model_spec.rb +++ b/spec/models/retainer_contract_model_spec.rb @@ -6,7 +6,7 @@ # # id :bigint not null, primary key # charge_upfront :boolean default(FALSE), not null -# expected_hours_per_period :float +# expected_hours_per_period :float default(0.0) # revenue_per_period :float # created_at :datetime not null # updated_at :datetime not null diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 879645c..48eca71 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -23,7 +23,6 @@ # Indexes # # index_users_on_email (email) UNIQUE -# index_users_on_google_id (google_id) UNIQUE # index_users_on_profession_id (profession_id) # index_users_on_slug (slug) UNIQUE #