Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clawback table columns #1259

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/claims/mentor_training.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#
# id :uuid not null, primary key
# date_completed :datetime
# hours_clawed_back :integer
# hours_completed :integer
# hours_rejected :integer
# not_assured :boolean default(FALSE)
# reason_clawed_back :text
# reason_not_assured :text
# reason_rejected :text
# rejected :boolean default(FALSE)
Expand Down Expand Up @@ -57,7 +58,6 @@ class Claims::MentorTraining < ApplicationRecord
only_integer: true,
}
validates :reason_rejected, presence: true, if: -> { rejected }
validates :hours_rejected, presence: true, if: -> { rejected }
validates :reason_not_assured, presence: true, if: -> { not_assured }

scope :without_hours, -> { where(hours_completed: nil).order_by_mentor_full_name }
Expand Down
3 changes: 2 additions & 1 deletion config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ shared:
- updated_at
- rejected
- reason_rejected
- hours_rejected
- not_assured
- reason_not_assured
- reason_clawed_back
- hours_clawed_back
:user_memberships:
- id
- user_id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class UpdateMentorTrainingsForClawbacks < ActiveRecord::Migration[7.2]
def change
safety_assured do
change_table(:mentor_trainings, bulk: true) do |t|
t.remove :hours_rejected, type: :integer
t.integer :hours_clawed_back
t.text :reason_clawed_back
end
end
end
end
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.2].define(version: 2024_12_18_111430) do
ActiveRecord::Schema[7.2].define(version: 2024_12_20_141331) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "plpgsql"
Expand Down Expand Up @@ -264,9 +264,10 @@
t.datetime "updated_at", null: false
t.boolean "rejected", default: false
t.text "reason_rejected"
t.integer "hours_rejected"
t.boolean "not_assured", default: false
t.text "reason_not_assured"
t.integer "hours_clawed_back"
t.text "reason_clawed_back"
t.index ["claim_id"], name: "index_mentor_trainings_on_claim_id"
t.index ["mentor_id"], name: "index_mentor_trainings_on_mentor_id"
t.index ["provider_id"], name: "index_mentor_trainings_on_provider_id"
Expand Down
3 changes: 2 additions & 1 deletion spec/factories/mentor_trainings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#
# id :uuid not null, primary key
# date_completed :datetime
# hours_clawed_back :integer
# hours_completed :integer
# hours_rejected :integer
# not_assured :boolean default(FALSE)
# reason_clawed_back :text
# reason_not_assured :text
# reason_rejected :text
# rejected :boolean default(FALSE)
Expand Down
8 changes: 2 additions & 6 deletions spec/models/claims/mentor_training_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#
# id :uuid not null, primary key
# date_completed :datetime
# hours_clawed_back :integer
# hours_completed :integer
# hours_rejected :integer
# not_assured :boolean default(FALSE)
# reason_clawed_back :text
# reason_not_assured :text
# reason_rejected :text
# rejected :boolean default(FALSE)
Expand Down Expand Up @@ -70,11 +71,6 @@
expect(mentor_training.valid?).to be(false)
expect(mentor_training.errors["reason_rejected"]).to include("can't be blank")
end

it "validates that the rejected hours is present" do
expect(mentor_training.valid?).to be(false)
expect(mentor_training.errors["hours_rejected"]).to include("can't be blank")
end
end

context "when rejected is false" do
Expand Down
Loading