Skip to content

Commit

Permalink
Merge pull request #1040 from DaanVanVugt/feature/add_referrer_to_wid…
Browse files Browse the repository at this point in the history
…get_logs

add referrer to widget logs
  • Loading branch information
fbacall authored Oct 25, 2024
2 parents 6e704b2 + 407126d commit 67c589c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def update_collections
def redirect
@event.widget_logs.create(widget_name: params[:widget],
action: "#{controller_name}##{action_name}",
referrer: request.referrer,
data: @event.url, params:)

redirect_to @event.url, allow_other_host: true
Expand All @@ -236,7 +237,7 @@ def event_params
{ host_institutions: [] }, :capacity, :contact, :recognition, :learning_objectives,
:prerequisites, :tech_requirements, :cost_basis, :cost_value, :cost_currency, :language,
external_resources_attributes: %i[id url title _destroy],
external_resources: [:url, :title], material_ids: [],
external_resources: %i[url title], material_ids: [],
llm_interaction_attributes: %i[id scrape_or_process model prompt input output needs_processing _destroy],
locked_fields: [])
end
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20241022113543_add_referrer_to_widget_logs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddReferrerToWidgetLogs < ActiveRecord::Migration[7.0]
def change
add_column :widget_logs, :referrer, :text
end
end
3 changes: 2 additions & 1 deletion 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.0].define(version: 2024_07_18_100022) do
ActiveRecord::Schema[7.0].define(version: 2024_10_22_113543) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -571,6 +571,7 @@
t.string "resource_type"
t.text "data"
t.json "params"
t.text "referrer"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["resource_type", "resource_id"], name: "index_widget_logs_on_resource_type_and_resource_id"
Expand Down

0 comments on commit 67c589c

Please sign in to comment.