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

5039 Remove deprecated learning_style column from learning_hour #5048

Merged
Show file tree
Hide file tree
Changes from 5 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
12 changes: 0 additions & 12 deletions app/models/learning_hour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ class LearningHour < ApplicationRecord
belongs_to :user
belongs_to :learning_hour_type

# Deprecated with Issue 5028
# Delete with Issue 5039 but only AFTER 5028 has been released to prod
enum learning_type: {
book: 1,
movie: 2,
webinar: 3,
conference: 4,
other: 5
}
# End delete

validates :duration_minutes, presence: true
validates :duration_minutes, numericality: {greater_than: 0}, if: :zero_duration_hours?
validates :name, presence: {message: "/ Title cannot be blank"}
Expand Down Expand Up @@ -41,7 +30,6 @@ def occurred_at_not_in_future
# id :bigint not null, primary key
# duration_hours :integer not null
# duration_minutes :integer not null
# learning_type :integer default("other")
# name :string not null
# occurred_at :datetime not null
# created_at :datetime not null
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20230730103110_remove_learning_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveLearningType < ActiveRecord::Migration[7.0]
def change
safety_assured { remove_column :learning_hours, :learning_type, :integer, default: 5, not_null: true }
end
end
1 change: 0 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@

create_table "learning_hours", force: :cascade do |t|
t.bigint "user_id", null: false
t.integer "learning_type", default: 5
t.string "name", null: false
t.integer "duration_minutes", null: false
t.integer "duration_hours", null: false
Expand Down
8 changes: 4 additions & 4 deletions spec/models/learning_hours_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
it "includes all learning hours" do
casa_org = build(:casa_org)
users = create_list(:user, 3, casa_org: casa_org)
learning_hour_type = create(:learning_hour_type)
learning_hour_types = create_list(:learning_hour_type, 3)
learning_hours =
[
create(:learning_hour, user: users[0], learning_hour_type: learning_hour_type),
create(:learning_hour, user: users[1], learning_type: :movie, learning_hour_type: learning_hour_type),
create(:learning_hour, user: users[2], learning_type: :webinar, learning_hour_type: learning_hour_type)
create(:learning_hour, user: users[0], learning_hour_type: learning_hour_types[0]),
create(:learning_hour, user: users[1], learning_hour_type: learning_hour_types[1]),
create(:learning_hour, user: users[2], learning_hour_type: learning_hour_types[2])
]
result = CSV.parse(described_class.new(casa_org.id).to_csv)

Expand Down
Loading