fix_select #23
@ -67,7 +67,11 @@ func (r *QuestionRepository) GetQuestionList(
|
||||
deleted, required bool,
|
||||
search, qType string, auditory int64) ([]model.Question, uint64, error) {
|
||||
query := `
|
||||
SELECT que.* FROM question as que JOIN quiz as qui on que.quiz_id = ANY(qui.parent_ids) or que.quiz_id = qui.id
|
||||
SELECT que.id, que.quiz_id, que.title, que.description, que.questiontype,
|
||||
que.required, que.deleted, que.page, que.content, que.version,
|
||||
que.parent_ids, que.created_at, que.updated_at, que.session, que.auditory
|
||||
FROM question as que
|
||||
JOIN quiz as qui on que.quiz_id = ANY(qui.parent_ids) or que.quiz_id = qui.id
|
||||
%s
|
||||
ORDER BY que.page, que.created_at ASC
|
||||
LIMIT $%d OFFSET $%d;
|
||||
|
||||
@ -90,7 +90,12 @@ func (r *QuizRepository) GetQuizList(
|
||||
ctx context.Context,
|
||||
deps GetQuizListDeps) ([]model.Quiz, uint64, error) {
|
||||
query := `
|
||||
SELECT * FROM quiz
|
||||
SELECT id, qid, accountid, deleted, archived, fingerprinting, repeatable, note_prevented,
|
||||
mail_notifications, unique_answers, super, group_id, name, description, config, status,
|
||||
limit_answers, due_to, time_of_passing, pausable, version, version_comment, parent_ids,
|
||||
created_at, updated_at, questions_count, answers_count, average_time_passing, sessions_count,
|
||||
gigachat
|
||||
FROM quiz
|
||||
%s
|
||||
ORDER BY created_at DESC
|
||||
LIMIT $1 OFFSET $2;
|
||||
@ -202,7 +207,7 @@ func (r *QuizRepository) GetQuizList(
|
||||
&piece.PassedCount,
|
||||
&piece.AverageTime,
|
||||
&piece.SessionCount,
|
||||
&piece.GigaChat,
|
||||
&piece.GigaChat,
|
||||
); err != nil {
|
||||
qerr = err
|
||||
return
|
||||
@ -261,7 +266,11 @@ func (r *QuizRepository) GetQuizByQid(ctx context.Context, qid string) (model.Qu
|
||||
}
|
||||
|
||||
fmt.Println("QUID", `
|
||||
SELECT * FROM quiz
|
||||
SELECT id, qid, accountid, deleted, archived, fingerprinting, repeatable, note_prevented,
|
||||
mail_notifications, unique_answers, super, group_id, name, description, config, status,
|
||||
limit_answers, due_to, time_of_passing, pausable, version, version_comment, parent_ids,
|
||||
created_at, updated_at, questions_count, answers_count, average_time_passing, sessions_count,
|
||||
gigachat FROM quiz
|
||||
WHERE
|
||||
deleted = false AND
|
||||
archived = false AND
|
||||
@ -269,7 +278,11 @@ WHERE
|
||||
qid = $1;
|
||||
`)
|
||||
rows, err := r.pool.QueryContext(ctx, `
|
||||
SELECT * FROM quiz
|
||||
SELECT id, qid, accountid, deleted, archived, fingerprinting, repeatable, note_prevented,
|
||||
mail_notifications, unique_answers, super, group_id, name, description, config, status,
|
||||
limit_answers, due_to, time_of_passing, pausable, version, version_comment, parent_ids,
|
||||
created_at, updated_at, questions_count, answers_count, average_time_passing, sessions_count,
|
||||
gigachat FROM quiz
|
||||
WHERE
|
||||
deleted = false AND
|
||||
archived = false AND
|
||||
@ -317,7 +330,7 @@ WHERE
|
||||
&piece.PassedCount,
|
||||
&piece.AverageTime,
|
||||
&piece.SessionCount,
|
||||
&piece.GigaChat,
|
||||
&piece.GigaChat,
|
||||
); err != nil {
|
||||
return model.Quiz{}, err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user