|
sql
lib/quiz/stats.rb:120
|
59%
|
lib/quiz/stats.rb:120
- Average Self
-
83ms
- Average calls
- 1x
- Total Self
- 83ms
- Total Children
- 0ms
- Total runtime
- 83ms
WITH first_answers AS (
SELECT
qa.user_id,
qa.question_id,
qa.proposition_id,
ROW_NUMBER() OVER (
PARTITION BY qa.user_id, qa.question_id
ORDER BY qa.id ASC
) AS row_number
FROM quiz_answers qa
WHERE qa.question_id IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?))))
),
points_counts AS (
SELECT
fa.user_id,
COUNT(CASE WHEN qp.correct = true THEN ? ELSE NULL END) AS points_count
FROM first_answers fa
INNER JOIN quiz_propositions qp ON qp.id = fa.proposition_id
WHERE fa.row_number = ?
GROUP BY fa.user_id
)
SELECT
user_id,
points_count,
DENSE_RANK() OVER (ORDER BY points_count DESC) AS rank
FROM points_counts;
|
|
sql
lib/quiz/stats.rb:26
|
7%
|
lib/quiz/stats.rb:26
- Average Self
-
9.7ms
- Average calls
- 1x
- Total Self
- 9.7ms
- Total Children
- 0ms
- Total runtime
- 9.7ms
SELECT COUNT(*) FROM "quiz_questions" WHERE ("quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)))
|
|
code
app/controllers/quiz/answers_controller.rb:50
|
6%
|
app/controllers/quiz/answers_controller.rb:50
- Average Self
-
8.6ms
- Average calls
- 1x
- Total Self
- 8.6ms
- Total Children
- 124ms
- Total runtime
- 132ms
Quiz::AnswersController#create
|
|
sql
app/controllers/concerns/guest_user.rb:27
|
5%
|
app/controllers/concerns/guest_user.rb:27
- Average Self
-
7.5ms
- Average calls
- 1x
- Total Self
- 7.5ms
- Total Children
- 0ms
- Total runtime
- 7.5ms
SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?
|
|
sql
lib/quiz/stats.rb:21
|
4%
|
lib/quiz/stats.rb:21
- Average Self
-
5ms
- Average calls
- 1x
- Total Self
- 5ms
- Total Children
- 0ms
- Total runtime
- 5ms
SELECT COUNT(*) FROM "quiz_answers" INNER JOIN "quiz_propositions" ON "quiz_propositions"."id" = "quiz_answers"."proposition_id" WHERE "quiz_answers"."question_id" IN (?) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)))) AND "quiz_answers"."id" IN (?) FROM "quiz_answers" WHERE "quiz_answers"."question_id" IN (?) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)))) AND "quiz_answers"."user_id" = ? GROUP BY "quiz_answers"."question_id") AND "quiz_propositions"."correct" = ?
|
|
sql
lib/quiz/stats.rb:16
|
3%
|
lib/quiz/stats.rb:16
- Average Self
-
4.1ms
- Average calls
- 1x
- Total Self
- 4.1ms
- Total Children
- 0ms
- Total runtime
- 4.1ms
SELECT COUNT(*) FROM "quiz_answers" WHERE "quiz_answers"."question_id" IN (?) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)))) AND "quiz_answers"."id" IN (?) FROM "quiz_answers" WHERE "quiz_answers"."question_id" IN (?) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)))) AND "quiz_answers"."user_id" = ? GROUP BY "quiz_answers"."question_id")
|
|
sql
lib/quiz/selection.rb:67
|
3%
|
lib/quiz/selection.rb:67
- Average Self
-
2.3ms
- Average calls
- 1.7x
- Total Self
- 3.9ms
- Total Children
- 0ms
- Total runtime
- 3.9ms
SELECT ? AS one FROM "quiz_questions" WHERE ("quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?)) OR "quiz_questions"."categorisable_type" = ? AND "quiz_questions"."categorisable_id" IN (?))) LIMIT ?
|
|
sql
app/controllers/quiz/answers_controller.rb:53
|
3%
|
app/controllers/quiz/answers_controller.rb:53
- Average Self
-
0.79ms
- Average calls
- 4.8x
- Total Self
- 3.8ms
- Total Children
- 0.65ms
- Total runtime
- 4.5ms
BEGIN
SELECT "quiz_questions".* FROM "quiz_questions" WHERE "quiz_questions"."id" = ? LIMIT ?
ROLLBACK
|
|
queue
queue
|
2%
|
queue
- Average Self
-
3.2ms
- Average calls
- 1x
- Total Self
- 3.2ms
- Total Children
- 0ms
- Total runtime
- 3.2ms
|
|
view
app/views/quiz/answers/_stats.html.erb
|
2%
|
app/views/quiz/answers/_stats.html.erb
- Average Self
-
3.1ms
- Average calls
- 1x
- Total Self
- 3.1ms
- Total Children
- 102ms
- Total runtime
- 105ms
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/warden-1.2.9/lib/warden/manager.rb:30
|
1%
|
/app/vendor/bundle/ruby/4.0.0/gems/warden-1.2.9/lib/warden/manager.rb:30
- Average Self
-
1.5ms
- Average calls
- 1x
- Total Self
- 1.5ms
- Total Children
- 132ms
- Total runtime
- 134ms
Warden::Manager
|
|
gc
ruby/gc.c
|
<1%
|
ruby/gc.c
- Average Self
-
3.2ms
- Average calls
- 0.38x
- Total Self
- 1.2ms
- Total Children
- 0ms
- Total runtime
- 1.2ms
GC.start
|
|
view
app/views/quiz/answers/create.turbo_stream.erb
|
<1%
|
app/views/quiz/answers/create.turbo_stream.erb
- Average Self
-
0.88ms
- Average calls
- 1x
- Total Self
- 0.88ms
- Total Children
- 106ms
- Total runtime
- 107ms
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/etag.rb:28
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/etag.rb:28
- Average Self
-
0.73ms
- Average calls
- 1x
- Total Self
- 0.73ms
- Total Children
- 134ms
- Total runtime
- 135ms
Rack::ETag
|
|
rack
ActionDispatch::Flash
|
<1%
|
ActionDispatch::Flash
- Average Self
-
0.71ms
- Average calls
- 1x
- Total Self
- 0.71ms
- Total Children
- 135ms
- Total runtime
- 136ms
|
|
view
app/views/quiz/answers/_answer.html.erb
|
<1%
|
app/views/quiz/answers/_answer.html.erb
- Average Self
-
0.71ms
- Average calls
- 1x
- Total Self
- 0.71ms
- Total Children
- 0ms
- Total runtime
- 0.71ms
|
|
sql
app/controllers/quiz/answers_controller.rb:54
|
<1%
|
app/controllers/quiz/answers_controller.rb:54
- Average Self
-
0.63ms
- Average calls
- 0.92x
- Total Self
- 0.58ms
- Total Children
- 0ms
- Total runtime
- 0.58ms
SELECT COUNT(*) FROM "quiz_answers" WHERE "quiz_answers"."user_id" = ?
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/railties-8.1.2/lib/rails/rack/logger.rb:20
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/railties-8.1.2/lib/rails/rack/logger.rb:20
- Average Self
-
0.57ms
- Average calls
- 1x
- Total Self
- 0.57ms
- Total Children
- 136ms
- Total runtime
- 137ms
Rails::Rack::Logger
|
|
sql
app/controllers/quiz/answers_controller.rb:84
|
<1%
|
app/controllers/quiz/answers_controller.rb:84
- Average Self
-
0.48ms
- Average calls
- 1x
- Total Self
- 0.48ms
- Total Children
- 0ms
- Total runtime
- 0.48ms
SELECT "quiz_propositions".* FROM "quiz_propositions" WHERE "quiz_propositions"."question_id" = ?
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-session-2.1.1/lib/rack/session/abstract/id.rb:267
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-session-2.1.1/lib/rack/session/abstract/id.rb:267
- Average Self
-
0.45ms
- Average calls
- 1x
- Total Self
- 0.45ms
- Total Children
- 136ms
- Total runtime
- 136ms
ActionDispatch::Session::CookieStore
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/method_override.rb:19
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/method_override.rb:19
- Average Self
-
0.27ms
- Average calls
- 1x
- Total Self
- 0.27ms
- Total Children
- 137ms
- Total runtime
- 137ms
Rack::MethodOverride
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/executor.rb:13
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/executor.rb:13
- Average Self
-
0.15ms
- Average calls
- 1x
- Total Self
- 0.15ms
- Total Children
- 137ms
- Total runtime
- 138ms
ActionDispatch::Executor
|
|
code
/app/vendor/bundle/ruby/4.0.0/gems/railties-8.1.2/lib/rails/engine.rb:532
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/railties-8.1.2/lib/rails/engine.rb:532
- Average Self
-
0.13ms
- Average calls
- 1x
- Total Self
- 0.13ms
- Total Children
- 138ms
- Total runtime
- 138ms
Rails::Engine#call
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/cookies.rb:706
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/cookies.rb:706
- Average Self
-
0.11ms
- Average calls
- 1x
- Total Self
- 0.11ms
- Total Children
- 136ms
- Total runtime
- 136ms
ActionDispatch::Cookies
|
|
sql
app/models/concerns/sluggable.rb:34
|
<1%
|
app/models/concerns/sluggable.rb:34
- Average Self
-
0.25ms
- Average calls
- 0.41x
- Total Self
- 0.1ms
- Total Children
- 0ms
- Total runtime
- 0.1ms
SELECT "sub_categories".* FROM "sub_categories" WHERE "sub_categories"."slug" = ? LIMIT ?
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/http/content_security_policy.rb:37
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/http/content_security_policy.rb:37
- Average Self
-
0.07ms
- Average calls
- 1x
- Total Self
- 0.07ms
- Total Children
- 135ms
- Total runtime
- 135ms
ActionDispatch::ContentSecurityPolicy::Middleware
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/conditional_get.rb:28
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/conditional_get.rb:28
- Average Self
-
0.07ms
- Average calls
- 1x
- Total Self
- 0.07ms
- Total Children
- 135ms
- Total runtime
- 135ms
Rack::ConditionalGet
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/tempfile_reaper.rb:16
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/tempfile_reaper.rb:16
- Average Self
-
0.07ms
- Average calls
- 1x
- Total Self
- 0.07ms
- Total Children
- 134ms
- Total runtime
- 134ms
Rack::TempfileReaper
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/head.rb:14
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/head.rb:14
- Average Self
-
0.06ms
- Average calls
- 1x
- Total Self
- 0.06ms
- Total Children
- 135ms
- Total runtime
- 135ms
Rack::Head
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/callbacks.rb:28
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/callbacks.rb:28
- Average Self
-
0.06ms
- Average calls
- 1x
- Total Self
- 0.06ms
- Total Children
- 136ms
- Total runtime
- 136ms
ActionDispatch::Callbacks
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/request_id.rb:31
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/request_id.rb:31
- Average Self
-
0.06ms
- Average calls
- 1x
- Total Self
- 0.06ms
- Total Children
- 137ms
- Total runtime
- 137ms
ActionDispatch::RequestId
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/debug_exceptions.rb:30
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/debug_exceptions.rb:30
- Average Self
-
0.05ms
- Average calls
- 1x
- Total Self
- 0.05ms
- Total Children
- 136ms
- Total runtime
- 136ms
ActionDispatch::DebugExceptions
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/show_exceptions.rb:31
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/show_exceptions.rb:31
- Average Self
-
0.05ms
- Average calls
- 1x
- Total Self
- 0.05ms
- Total Children
- 136ms
- Total runtime
- 136ms
ActionDispatch::ShowExceptions
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/request_store-1.7.0/lib/request_store/middleware.rb:16
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/request_store-1.7.0/lib/request_store/middleware.rb:16
- Average Self
-
0.04ms
- Average calls
- 1x
- Total Self
- 0.04ms
- Total Children
- 137ms
- Total runtime
- 137ms
RequestStore::Middleware
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-rewrite-1.5.1/lib/rack/rewrite.rb:18
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-rewrite-1.5.1/lib/rack/rewrite.rb:18
- Average Self
-
0.04ms
- Average calls
- 1x
- Total Self
- 0.04ms
- Total Children
- 137ms
- Total runtime
- 137ms
Rack::Rewrite
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/railties-8.1.2/lib/rails/rack/silence_request.rb:27
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/railties-8.1.2/lib/rails/rack/silence_request.rb:27
- Average Self
-
0.04ms
- Average calls
- 1x
- Total Self
- 0.04ms
- Total Children
- 137ms
- Total runtime
- 137ms
Rails::Rack::SilenceRequest
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/runtime.rb:22
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/runtime.rb:22
- Average Self
-
0.04ms
- Average calls
- 1x
- Total Self
- 0.04ms
- Total Children
- 137ms
- Total runtime
- 137ms
Rack::Runtime
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/remote_ip.rb:95
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/remote_ip.rb:95
- Average Self
-
0.04ms
- Average calls
- 1x
- Total Self
- 0.04ms
- Total Children
- 137ms
- Total runtime
- 137ms
ActionDispatch::RemoteIp
|
|
sql
app/models/sub_category.rb:106
|
<1%
|
app/models/sub_category.rb:106
- Average Self
-
0.18ms
- Average calls
- 0.21x
- Total Self
- 0.04ms
- Total Children
- 0ms
- Total runtime
- 0.04ms
SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT ?
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/static.rb:26
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/actionpack-8.1.2/lib/action_dispatch/middleware/static.rb:26
- Average Self
-
0.04ms
- Average calls
- 1x
- Total Self
- 0.04ms
- Total Children
- 138ms
- Total runtime
- 138ms
ActionDispatch::Static
|
|
rack
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/sendfile.rb:130
|
<1%
|
/app/vendor/bundle/ruby/4.0.0/gems/rack-3.2.4/lib/rack/sendfile.rb:130
- Average Self
-
0.04ms
- Average calls
- 1x
- Total Self
- 0.04ms
- Total Children
- 138ms
- Total runtime
- 138ms
Rack::Sendfile
|
|
sql
app/controllers/quiz/answers_controller.rb:56
|
<1%
|
app/controllers/quiz/answers_controller.rb:56
- Average Self
-
0.41ms
- Average calls
- 0.08x
- Total Self
- 0.03ms
- Total Children
- 0ms
- Total runtime
- 0.03ms
SELECT COUNT(*) FROM "quiz_answers" WHERE "quiz_answers"."user_id" = ?
|