upd with column auditory
This commit is contained in:
parent
d27fa4798a
commit
670c3afd4e
@ -1094,7 +1094,7 @@ UPDATE amoContact SET Field = $1,AmoID=$3 WHERE ID = $2;
|
|||||||
|
|
||||||
-- name: GetQuestionsAI :many
|
-- name: GetQuestionsAI :many
|
||||||
SELECT q.id, q.quiz_id, q.title, q.description, q.questiontype, q.required, q.deleted, q.page, q.content, q.version, q.parent_ids, q.created_at, q.updated_at, q.session,q.auditory FROM question q
|
SELECT q.id, q.quiz_id, q.title, q.description, q.questiontype, q.required, q.deleted, q.page, q.content, q.version, q.parent_ids, q.created_at, q.updated_at, q.session,q.auditory FROM question q
|
||||||
WHERE q.quiz_id = $1 AND (q.session = $2 OR q.session = '') AND q.deleted = FALSE
|
WHERE q.quiz_id = $1 AND (q.session = $2 OR q.session = '') AND q.deleted = FALSE AND q.auditory = $3
|
||||||
ORDER BY (q.session != '') ASC, --без сессии первые потом с сессией
|
ORDER BY (q.session != '') ASC, --без сессии первые потом с сессией
|
||||||
q.page, --по возрастанию страницы
|
q.page, --по возрастанию страницы
|
||||||
q.created_at --по времени создания
|
q.created_at --по времени создания
|
||||||
|
@ -65,7 +65,7 @@ func (r *QuestionRepository) GetQuestionList(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
limit, offset, from, to, quizId uint64,
|
limit, offset, from, to, quizId uint64,
|
||||||
deleted, required bool,
|
deleted, required bool,
|
||||||
search, qType string) ([]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.* FROM question as que JOIN quiz as qui on que.quiz_id = ANY(qui.parent_ids) or que.quiz_id = qui.id
|
||||||
%s
|
%s
|
||||||
@ -111,7 +111,7 @@ func (r *QuestionRepository) GetQuestionList(
|
|||||||
whereClause = append(whereClause, fmt.Sprintf("to_tsvector('russian', que.title) @@ to_tsquery('russian', $%d)", len(data)))
|
whereClause = append(whereClause, fmt.Sprintf("to_tsvector('russian', que.title) @@ to_tsquery('russian', $%d)", len(data)))
|
||||||
}
|
}
|
||||||
|
|
||||||
whereClause = append(whereClause, "que.auditory = 0")
|
whereClause = append(whereClause, fmt.Sprintf("que.auditory = %d", auditory))
|
||||||
|
|
||||||
data = append(data, limit, offset)
|
data = append(data, limit, offset)
|
||||||
if len(whereClause) != 0 {
|
if len(whereClause) != 0 {
|
||||||
@ -498,7 +498,7 @@ func (r *QuestionRepository) GetQuestionListByIDs(ctx context.Context, ids []int
|
|||||||
return questions, nil
|
return questions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *QuestionRepository) GetQuestionsAI(ctx context.Context, quizID int64, session string, limit, offset int32) ([]model.Question, uint64, error) {
|
func (r *QuestionRepository) GetQuestionsAI(ctx context.Context, quizID int64, session string, limit, offset int32, auditory) ([]model.Question, uint64, error) {
|
||||||
rows, err := r.queries.GetQuestionsAI(ctx, sqlcgen.GetQuestionsAIParams{
|
rows, err := r.queries.GetQuestionsAI(ctx, sqlcgen.GetQuestionsAIParams{
|
||||||
QuizID: quizID,
|
QuizID: quizID,
|
||||||
Session: session,
|
Session: session,
|
||||||
|
Loading…
Reference in New Issue
Block a user