fix question statistic query
This commit is contained in:
parent
5136009e94
commit
f756683012
@ -522,7 +522,7 @@ WITH Funnel AS (
|
||||
),
|
||||
Results AS (
|
||||
SELECT
|
||||
q.title AS question_title,
|
||||
COALESCE(q.title, '') AS question_title,
|
||||
COUNT(*) AS total_answers,
|
||||
CAST(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) FILTER (WHERE a.result = TRUE) OVER (PARTITION BY a.quiz_id), 0) AS FLOAT8) AS percentage
|
||||
FROM
|
||||
@ -587,18 +587,16 @@ SELECT
|
||||
Funnel.count_start_true,
|
||||
Funnel.count_f_result_with_t_question,
|
||||
Funnel.count_t_result,
|
||||
Results.question_title AS results_title,
|
||||
Results.percentage AS results_percentage,
|
||||
Questions.question_title AS questions_title,
|
||||
COALESCE(Results.question_title, '') AS results_title,
|
||||
COALESCE(Results.percentage, 0) AS results_percentage,
|
||||
COALESCE(Questions.question_title, '') AS questions_title,
|
||||
COALESCE(Questions.question_page, 0) AS questions_page,
|
||||
Questions.answer_content AS answer_content,
|
||||
Questions.percentage AS questions_percentage
|
||||
COALESCE(Questions.answer_content, '') AS answer_content,
|
||||
COALESCE(Questions.percentage, 0) AS questions_percentage
|
||||
FROM
|
||||
Funnel,
|
||||
Results,
|
||||
Questions
|
||||
WHERE
|
||||
Questions.percentage >= 1;
|
||||
Funnel
|
||||
LEFT JOIN Results ON true
|
||||
LEFT JOIN Questions ON Questions.percentage >= 1;
|
||||
|
||||
-- name: QuizCopyQid :one
|
||||
INSERT INTO quiz (
|
||||
|
Loading…
Reference in New Issue
Block a user