Skip to content

Commit

Permalink
LTI-190: Update handler_legacy if passed and nil (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico authored Feb 13, 2023
1 parent 72f3c86 commit 52816a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions app/controllers/rooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,14 @@ def set_launch
# Continue through happy path.
@tenant = session_params['tenant']
resource_handler = Digest::SHA1.hexdigest("rooms#{@tenant}#{launch_params['resource_link_id']}")
@room = Room.find_or_create_by(handler: resource_handler, tenant: @tenant) do |room|
room.update(launch_params_to_new_room_params(launch_params))
to_new_room_params = launch_params_to_new_room_params(launch_params)
@room = Room.find_by(handler: resource_handler, tenant: @tenant)
if @room
@room.update(to_new_room_params)
else
@room = Room.create(to_new_room_params)
end

user_params = launch_params_to_new_user_params(launch_params)
session[@room.handler] = { user_params: user_params }
end
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Settings specified here will take precedence over those in config/application.rb.

# Code is not reloaded between requests.
config.cache_classes = true
config.cache_classes = (ENV['DEVELOPER_MODE_ENABLED'] != 'true')

# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
t.string "tenant"
t.boolean "hide_name"
t.boolean "hide_description"
t.jsonb "settings", default: {}, null: false
t.string "handler_legacy"
t.jsonb "settings", default: {}, null: false
t.index ["tenant", "handler"], name: "index_rooms_on_tenant_and_handler", unique: true
t.index ["tenant", "handler_legacy"], name: "index_rooms_on_tenant_and_handler_legacy", unique: true
end
Expand Down

0 comments on commit 52816a2

Please sign in to comment.