4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/onboard_on_rails/api/tours_controller.rb', line 4
def index
matcher = TourMatcher.new(
user: current_user,
url: params[:url],
session_id: params[:session_id],
device_type: params[:device_type],
request: request
)
tour = matcher.match
if tour
completion = Completion.find_by(tour: tour, user_id: current_user.id)
render json: {
tour: serialize_tour(tour, matcher.current_step_index, completion)
}
else
render json: { tour: nil }
end
end
|