Currently the questions_import form prompts for a quiz to import the questions into. I think it will be uncommon that users want to add the questions they are importing into an existing quiz.
I propose that the import form create a new collection from the imported file and prompt for a name for this collection. Alternately, the user could be given the choice to name a new collection or choose an existing collection or quiz to append to.
Thoughts?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | quiz-515238a.patch.zip | 2.77 KB | dbesse |
Comments
Comment #1
dbesse commentedThis adds the database structure and creates a database entry for each import file as well as one associating each question imported with which file its from. Doesn't change anything with files, or item collections/quizzes. Also doesn't log errors yet as I wasn't sure which errors were supposed to be logged.
Comment #2
turadg commentedLooks good. I've added the file storage and fixed a few other things, so I think we're good to go. I'm setting this to "needs review" for the co-maintainers to check out.
Some comments:
1) The cleaner way you were looking for to get the last inserted id is:
$import_id = db_last_insert_id('quiz_questions_import_record', 'import_id');
2) The files table is keyed by unsigned integer so the file field in `quiz_questions_import_record` should be unsigned. Also, the `import_id` has to be set to type 'serial' which it will translate in MySQL to "auto_increment". Without that, each insert was having the same 0 id.
I've updated my DB and the schema that gets installed and run on update. You're probably the only person with the interim schema so instead of writing another hook you can just run this on your db:
ALTER TABLE `qcommons_staging`.`quiz_questions_import_record` MODIFY COLUMN `import_id` INTEGER UNSIGNED NOT NULL DEFAULT NULL AUTO_INCREMENT,
MODIFY COLUMN `file_id` INTEGER UNSIGNED;
Comment #3
turadg commentedThe last patch set up the import record but not the ability to make a new quiz or collection instead of importing into an existing one.
I just committed to 4.x that UI and logic.
Comment #4
turadg commented