refactor template copy
This commit is contained in:
parent
31f9f421fc
commit
526a1ca20f
@ -657,7 +657,7 @@ SELECT id
|
||||
FROM quiz
|
||||
WHERE accountid = $1;
|
||||
|
||||
-- name: TemplateCopy :exec
|
||||
-- name: TemplateCopy :one
|
||||
WITH copied_quiz AS (
|
||||
INSERT INTO quiz (accountid, name,fingerprinting,repeatable,note_prevented,mail_notifications,unique_answers,super,group_id, description, config, status,limit_answers,due_to,time_of_passing,pausable,version,version_comment, parent_ids)
|
||||
SELECT $1 AS accountid,name,fingerprinting,repeatable,note_prevented,mail_notifications,unique_answers,super,group_id, description, config, 'stop' AS status,limit_answers,due_to,time_of_passing,pausable,version,version_comment, parent_ids
|
||||
@ -669,7 +669,8 @@ INSERT INTO question (quiz_id, title, description, questiontype, required, delet
|
||||
SELECT cq.id AS quiz_id, q.title, q.description, q.questiontype, q.required, q.deleted, q.page, q.content, q.version, q.parent_ids
|
||||
FROM question q
|
||||
JOIN quiz old ON q.quiz_id = old.id
|
||||
JOIN copied_quiz cq ON old.qid = $2;
|
||||
JOIN copied_quiz cq ON old.qid = $2
|
||||
RETURNING cq.id;
|
||||
|
||||
|
||||
-- amo methods:
|
||||
|
Loading…
Reference in New Issue
Block a user