fix_select #23
@ -67,7 +67,11 @@ func (r *QuestionRepository) GetQuestionList(
|
|||||||
deleted, required bool,
|
deleted, required bool,
|
||||||
search, qType string, auditory int64) ([]model.Question, uint64, error) {
|
search, qType string, auditory int64) ([]model.Question, uint64, error) {
|
||||||
query := `
|
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
|
%s
|
||||||
ORDER BY que.page, que.created_at ASC
|
ORDER BY que.page, que.created_at ASC
|
||||||
LIMIT $%d OFFSET $%d;
|
LIMIT $%d OFFSET $%d;
|
||||||
|
|||||||
@ -90,7 +90,12 @@ func (r *QuizRepository) GetQuizList(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
deps GetQuizListDeps) ([]model.Quiz, uint64, error) {
|
deps GetQuizListDeps) ([]model.Quiz, uint64, error) {
|
||||||
query := `
|
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
|
%s
|
||||||
ORDER BY created_at DESC
|
ORDER BY created_at DESC
|
||||||
LIMIT $1 OFFSET $2;
|
LIMIT $1 OFFSET $2;
|
||||||
@ -202,7 +207,7 @@ func (r *QuizRepository) GetQuizList(
|
|||||||
&piece.PassedCount,
|
&piece.PassedCount,
|
||||||
&piece.AverageTime,
|
&piece.AverageTime,
|
||||||
&piece.SessionCount,
|
&piece.SessionCount,
|
||||||
&piece.GigaChat,
|
&piece.GigaChat,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
qerr = err
|
qerr = err
|
||||||
return
|
return
|
||||||
@ -261,7 +266,11 @@ func (r *QuizRepository) GetQuizByQid(ctx context.Context, qid string) (model.Qu
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("QUID", `
|
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
|
WHERE
|
||||||
deleted = false AND
|
deleted = false AND
|
||||||
archived = false AND
|
archived = false AND
|
||||||
@ -269,7 +278,11 @@ WHERE
|
|||||||
qid = $1;
|
qid = $1;
|
||||||
`)
|
`)
|
||||||
rows, err := r.pool.QueryContext(ctx, `
|
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
|
WHERE
|
||||||
deleted = false AND
|
deleted = false AND
|
||||||
archived = false AND
|
archived = false AND
|
||||||
@ -317,7 +330,7 @@ WHERE
|
|||||||
&piece.PassedCount,
|
&piece.PassedCount,
|
||||||
&piece.AverageTime,
|
&piece.AverageTime,
|
||||||
&piece.SessionCount,
|
&piece.SessionCount,
|
||||||
&piece.GigaChat,
|
&piece.GigaChat,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return model.Quiz{}, err
|
return model.Quiz{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user