added in QuestionsStatistics some !=start
This commit is contained in:
parent
1383dbaa3a
commit
db6777276d
@ -513,7 +513,7 @@ FROM
|
|||||||
|
|
||||||
-- name: QuestionsStatistics :many
|
-- name: QuestionsStatistics :many
|
||||||
WITH QuizAnswers AS (
|
WITH QuizAnswers AS (
|
||||||
SELECT
|
SELECT
|
||||||
session, start, result, question_id, created_at, content, quiz_id
|
session, start, result, question_id, created_at, content, quiz_id
|
||||||
FROM answer
|
FROM answer
|
||||||
WHERE answer.quiz_id = $1 AND created_at between TO_TIMESTAMP($2)::timestamp and TO_TIMESTAMP($3)::timestamp
|
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($2)
|
||||||
AND a.created_at <= TO_TIMESTAMP($3)
|
AND a.created_at <= TO_TIMESTAMP($3)
|
||||||
AND a.result = TRUE
|
AND a.result = TRUE
|
||||||
|
AND a.start = FALSE
|
||||||
GROUP BY
|
GROUP BY
|
||||||
q.title, a.quiz_id, a.result
|
q.title, a.quiz_id, a.result
|
||||||
HAVING
|
HAVING
|
||||||
@ -567,7 +568,7 @@ SELECT
|
|||||||
QuizAnswers
|
QuizAnswers
|
||||||
WHERE
|
WHERE
|
||||||
quiz_id = $1
|
quiz_id = $1
|
||||||
AND start != true
|
AND start = FALSE
|
||||||
AND created_at >= TO_TIMESTAMP($2)
|
AND created_at >= TO_TIMESTAMP($2)
|
||||||
AND created_at <= TO_TIMESTAMP($3)
|
AND created_at <= TO_TIMESTAMP($3)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
@ -588,7 +589,7 @@ SELECT
|
|||||||
JOIN answer a ON q.id = a.question_id
|
JOIN answer a ON q.id = a.question_id
|
||||||
WHERE
|
WHERE
|
||||||
a.quiz_id = $1
|
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($2)
|
||||||
AND a.created_at <= TO_TIMESTAMP($3)
|
AND a.created_at <= TO_TIMESTAMP($3)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
|||||||
@ -4773,7 +4773,7 @@ func (q *Queries) MoveToHistoryQuiz(ctx context.Context, arg MoveToHistoryQuizPa
|
|||||||
|
|
||||||
const questionsStatistics = `-- name: QuestionsStatistics :many
|
const questionsStatistics = `-- name: QuestionsStatistics :many
|
||||||
WITH QuizAnswers AS (
|
WITH QuizAnswers AS (
|
||||||
SELECT
|
SELECT
|
||||||
session, start, result, question_id, created_at, content, quiz_id
|
session, start, result, question_id, created_at, content, quiz_id
|
||||||
FROM answer
|
FROM answer
|
||||||
WHERE answer.quiz_id = $1 AND created_at between TO_TIMESTAMP($2)::timestamp and TO_TIMESTAMP($3)::timestamp
|
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($2)
|
||||||
AND a.created_at <= TO_TIMESTAMP($3)
|
AND a.created_at <= TO_TIMESTAMP($3)
|
||||||
AND a.result = TRUE
|
AND a.result = TRUE
|
||||||
|
AND a.start = FALSE
|
||||||
GROUP BY
|
GROUP BY
|
||||||
q.title, a.quiz_id, a.result
|
q.title, a.quiz_id, a.result
|
||||||
HAVING
|
HAVING
|
||||||
@ -4827,7 +4828,7 @@ SELECT
|
|||||||
QuizAnswers
|
QuizAnswers
|
||||||
WHERE
|
WHERE
|
||||||
quiz_id = $1
|
quiz_id = $1
|
||||||
AND start != true
|
AND start = FALSE
|
||||||
AND created_at >= TO_TIMESTAMP($2)
|
AND created_at >= TO_TIMESTAMP($2)
|
||||||
AND created_at <= TO_TIMESTAMP($3)
|
AND created_at <= TO_TIMESTAMP($3)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
@ -4848,7 +4849,7 @@ SELECT
|
|||||||
JOIN answer a ON q.id = a.question_id
|
JOIN answer a ON q.id = a.question_id
|
||||||
WHERE
|
WHERE
|
||||||
a.quiz_id = $1
|
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($2)
|
||||||
AND a.created_at <= TO_TIMESTAMP($3)
|
AND a.created_at <= TO_TIMESTAMP($3)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user