added in QuestionsStatistics some !=start

This commit is contained in:
pasha1coil 2025-08-24 09:46:09 +03:00
parent 1383dbaa3a
commit db6777276d
2 changed files with 8 additions and 6 deletions

@ -513,7 +513,7 @@ FROM
-- name: QuestionsStatistics :many
WITH QuizAnswers AS (
SELECT
SELECT
session, start, result, question_id, created_at, content, quiz_id
FROM answer
WHERE answer.quiz_id = $1 AND created_at between TO_TIMESTAMP($2)::timestamp and TO_TIMESTAMP($3)::timestamp
@ -545,6 +545,7 @@ SELECT
AND a.created_at >= TO_TIMESTAMP($2)
AND a.created_at <= TO_TIMESTAMP($3)
AND a.result = TRUE
AND a.start = FALSE
GROUP BY
q.title, a.quiz_id, a.result
HAVING
@ -567,7 +568,7 @@ SELECT
QuizAnswers
WHERE
quiz_id = $1
AND start != true
AND start = FALSE
AND created_at >= TO_TIMESTAMP($2)
AND created_at <= TO_TIMESTAMP($3)
GROUP BY
@ -588,7 +589,7 @@ SELECT
JOIN answer a ON q.id = a.question_id
WHERE
a.quiz_id = $1
AND a.start != true
AND a.start = FALSE
AND a.created_at >= TO_TIMESTAMP($2)
AND a.created_at <= TO_TIMESTAMP($3)
GROUP BY

@ -4773,7 +4773,7 @@ func (q *Queries) MoveToHistoryQuiz(ctx context.Context, arg MoveToHistoryQuizPa
const questionsStatistics = `-- name: QuestionsStatistics :many
WITH QuizAnswers AS (
SELECT
SELECT
session, start, result, question_id, created_at, content, quiz_id
FROM answer
WHERE answer.quiz_id = $1 AND created_at between TO_TIMESTAMP($2)::timestamp and TO_TIMESTAMP($3)::timestamp
@ -4805,6 +4805,7 @@ SELECT
AND a.created_at >= TO_TIMESTAMP($2)
AND a.created_at <= TO_TIMESTAMP($3)
AND a.result = TRUE
AND a.start = FALSE
GROUP BY
q.title, a.quiz_id, a.result
HAVING
@ -4827,7 +4828,7 @@ SELECT
QuizAnswers
WHERE
quiz_id = $1
AND start != true
AND start = FALSE
AND created_at >= TO_TIMESTAMP($2)
AND created_at <= TO_TIMESTAMP($3)
GROUP BY
@ -4848,7 +4849,7 @@ SELECT
JOIN answer a ON q.id = a.question_id
WHERE
a.quiz_id = $1
AND a.start != true
AND a.start = FALSE
AND a.created_at >= TO_TIMESTAMP($2)
AND a.created_at <= TO_TIMESTAMP($3)
GROUP BY