update sqlc gen
This commit is contained in:
parent
36ac5dc116
commit
b2bfeb7a10
@ -538,12 +538,15 @@ WITH Funnel AS (
|
||||
SELECT
|
||||
q.title AS question_title,
|
||||
a.content AS answer_content,
|
||||
CASE
|
||||
WHEN COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0) - TRUNC(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0)) >= 0.5 THEN
|
||||
CEIL(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
ELSE
|
||||
FLOOR(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
END AS percentage
|
||||
CAST(
|
||||
CASE
|
||||
WHEN COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0) - TRUNC(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0)) >= 0.5 THEN
|
||||
CEIL(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
ELSE
|
||||
FLOOR(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
END
|
||||
AS INTEGER
|
||||
) AS percentage
|
||||
FROM
|
||||
question q
|
||||
JOIN answer a ON q.id = a.question_id
|
||||
@ -551,6 +554,7 @@ WITH Funnel AS (
|
||||
a.quiz_id = $1
|
||||
AND a.created_at >= TO_TIMESTAMP($2)
|
||||
AND a.created_at <= TO_TIMESTAMP($3)
|
||||
AND a.result = FALSE
|
||||
GROUP BY
|
||||
q.id, q.title, a.content
|
||||
HAVING
|
||||
|
||||
@ -1632,12 +1632,15 @@ WITH Funnel AS (
|
||||
SELECT
|
||||
q.title AS question_title,
|
||||
a.content AS answer_content,
|
||||
CASE
|
||||
WHEN COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0) - TRUNC(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0)) >= 0.5 THEN
|
||||
CEIL(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
ELSE
|
||||
FLOOR(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
END AS percentage
|
||||
CAST(
|
||||
CASE
|
||||
WHEN COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0) - TRUNC(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0)) >= 0.5 THEN
|
||||
CEIL(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
ELSE
|
||||
FLOOR(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0))
|
||||
END
|
||||
AS INTEGER
|
||||
) AS percentage
|
||||
FROM
|
||||
question q
|
||||
JOIN answer a ON q.id = a.question_id
|
||||
@ -1645,6 +1648,7 @@ WITH Funnel AS (
|
||||
a.quiz_id = $1
|
||||
AND a.created_at >= TO_TIMESTAMP($2)
|
||||
AND a.created_at <= TO_TIMESTAMP($3)
|
||||
AND a.result = FALSE
|
||||
GROUP BY
|
||||
q.id, q.title, a.content
|
||||
HAVING
|
||||
@ -1683,7 +1687,7 @@ type QuestionsStatisticsRow struct {
|
||||
ResultsPercentage int32 `db:"results_percentage" json:"results_percentage"`
|
||||
QuestionsTitle string `db:"questions_title" json:"questions_title"`
|
||||
AnswerContent sql.NullString `db:"answer_content" json:"answer_content"`
|
||||
QuestionsPercentage interface{} `db:"questions_percentage" json:"questions_percentage"`
|
||||
QuestionsPercentage int32 `db:"questions_percentage" json:"questions_percentage"`
|
||||
}
|
||||
|
||||
func (q *Queries) QuestionsStatistics(ctx context.Context, arg QuestionsStatisticsParams) ([]QuestionsStatisticsRow, error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user