update sqlc gen
This commit is contained in:
parent
4305a04063
commit
1e67bb6da0
@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.25.0
|
||||
// sqlc v1.26.0
|
||||
|
||||
package sqlcgen
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.25.0
|
||||
// sqlc v1.26.0
|
||||
|
||||
package sqlcgen
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.25.0
|
||||
// sqlc v1.26.0
|
||||
// source: queries.sql
|
||||
|
||||
package sqlcgen
|
||||
@ -1727,22 +1727,44 @@ WITH Funnel AS (
|
||||
HAVING
|
||||
COUNT(*) >= 1
|
||||
),
|
||||
LastContent AS (
|
||||
SELECT
|
||||
a.question_id,
|
||||
a.content AS last_answer_content
|
||||
FROM
|
||||
answer a
|
||||
JOIN (
|
||||
SELECT
|
||||
session,
|
||||
question_id,
|
||||
MAX(created_at) AS last_created_at
|
||||
FROM
|
||||
answer
|
||||
WHERE
|
||||
quiz_id = $1
|
||||
AND created_at >= TO_TIMESTAMP($2)
|
||||
AND created_at <= TO_TIMESTAMP($3)
|
||||
GROUP BY
|
||||
question_id, session
|
||||
) AS last_created_at_one_session ON a.session = last_created_at_one_session.session AND a.question_id = last_created_at_one_session.question_id AND a.created_at = last_created_at_one_session.last_created_at
|
||||
),
|
||||
Questions AS (
|
||||
SELECT
|
||||
q.title AS question_title,
|
||||
a.content AS answer_content,
|
||||
lc.last_answer_content AS answer_content,
|
||||
CAST(
|
||||
COUNT(CASE WHEN a.result = FALSE THEN 1 END) * 100.0 / NULLIF(SUM(COUNT(CASE WHEN a.result = FALSE THEN 1 END)) OVER (PARTITION BY q.id), 0) AS FLOAT8
|
||||
) AS percentage
|
||||
FROM
|
||||
question q
|
||||
JOIN LastContent lc ON q.id = lc.question_id
|
||||
JOIN answer a ON q.id = a.question_id
|
||||
WHERE
|
||||
a.quiz_id = $1
|
||||
AND a.created_at >= TO_TIMESTAMP($2)
|
||||
AND a.created_at <= TO_TIMESTAMP($3)
|
||||
GROUP BY
|
||||
q.id, q.title, a.content
|
||||
q.id, q.title, lc.last_answer_content
|
||||
HAVING
|
||||
COUNT(*) >= 1
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user