Skip to content

Commit

Permalink
Add registered_at timestamp in do_add endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed Feb 21, 2025
1 parent 4ee4d38 commit 10c420b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def do_add
end
ActiveRecord::Base.transaction do
user, locked_account_created = user_for_registration!(params[:registration_data])
registration = @competition.registrations.find_or_initialize_by(user_id: user.id)
registration = @competition.registrations.find_or_initialize_by(user_id: user.id) do |reg|
reg.registered_at = Time.now.utc
end
raise I18n.t("registrations.add.errors.already_registered") unless registration.new_record?
registration_comment = params.dig(:registration_data, :comments)
registration.assign_attributes(comments: registration_comment) if registration_comment.present?
Expand Down

0 comments on commit 10c420b

Please sign in to comment.