File type question#681
Conversation
|
Thanks. I will review. In the meantime, can you fix the CI errors please? |
c142a07 to
5f1ec08
Compare
fbaf4cc to
1b8da9e
Compare
|
CI errors should be fixed by now. |
|
Can you do a rebase with the current MOODLE_500_STABLE branch please? There are commits here that shouldn't be. |
|
It is already rebased on your MOODLE_500_STABLE branch. When I tried a fetch and rebase now, it claimed to be up to date already. |
|
Hmmm... Okay. Looks like this commit was missing from the 500 branch. I'll keep it. I will leave some comments in the code review as well. |
mchurchward
left a comment
There was a problem hiding this comment.
Well I appreciate the changes made that are not part of this actual issue, it is really necessary to limit the changes to the specific issue. If there are CI issues that are not caused by your code, they should be fixed separately. Can you simplify this PR? Possibly make a new one limited to the only the code needed for this question type?
mchurchward
left a comment
There was a problem hiding this comment.
Testing functionality.
I added a file type question. I set the questionnaire so that I could save and resume. I added a file to the file question and saved my response. When I resumed, there was no file attached. I think that needs to be saved too.
|
Thanks for looking at it, I will see that I implement the changes within the next days. I inform you as soon as I am done. |
Fix upload when several file upload questions are used. - Adjust siganture of methods to their parent - Limit the files to upload to one for each question - Use questionaire id for file draft area instead of question id in the questionaire. Fix handling of file uploads - allow upload of one file only. - new submit does not load previously existing files. Change refence of file.itemid to questionnaire_response_file.id update existing files.itemid to questionnaire_response_file.id
Improvements to satisfy code checker. Make the file upload work with required setting, fix delete of records Add file question type
Fix cleanup of old file responses. Add backup/restore handling for file response type.
202e766 to
c42bf28
Compare
|
Hi Mike, I just finished working on it and it works from my point of few now. Could you please have another check? Also, now in this diff I can explain all the changes. There should be no left overs from other stuff. Thank you, Stephan |
c42bf28 to
02a3305
Compare
02a3305 to
12b9cce
Compare
12b9cce to
8d9e780
Compare
|
Thanks for all your work on this. I will strive to review this soon. |
mchurchward
left a comment
There was a problem hiding this comment.
One last change. The current MOODLE_500_STABLE uses version 2025041400.01. Can you change the version file in the PR to use 2025041400.02, and then update your upgrade.php file as well? Then I can merge.
mchurchward
left a comment
There was a problem hiding this comment.
I just tested the backup and restore with file type questions and I don't think its working yet. The restore didn't seem to restore the uploaded files into the results.
Test steps:
- Install questionnaire with file question type.
- Add a questionnaire with a couple of questions including file type.
- Respond from a couple of users, uploading different files.
- Backup the course with just the questionnaire and all responses.
- Download the backup file and keep.
- Uninstall questionnaire - this hopefully ensures that the uploaded files are removed.
- Reinstall questionnaire.
- Restore the saved questionnaire backup into the same course as before.
- Look a the restored responses. The file questions should have files. In my test, they were missing.
|
Thanks for the comment. Indeed, I see that in a fresh instance the images are not imported, or at least not visible in the responses. I'll fix that. |
|
Hi Mike, the restore works now. I also updated the version as requested. |
061d48f to
5c84f20
Compare
5c84f20 to
8c82448
Compare
|
Thanks for the fixes and all of the work you have put into this. It will be a great addition. |
* Circumvent number on string error, resolves #538. (#563) * Add file question type Fix upload when several file upload questions are used. - Adjust siganture of methods to their parent - Limit the files to upload to one for each question - Use questionaire id for file draft area instead of question id in the questionaire. Fix handling of file uploads - allow upload of one file only. - new submit does not load previously existing files. Change refence of file.itemid to questionnaire_response_file.id update existing files.itemid to questionnaire_response_file.id Improvements to satisfy code checker. Make the file upload work with required setting, fix delete of records * Make sid public, because its already used via #[\AllowDynamicProperties] Fix cleanup of old file responses. Add backup/restore handling for file response type. * Fix restore of files in backup. --------- Co-authored-by: Luca Bösch <luca.boesch@bfh.ch> Co-authored-by: Laurent David <lmedavid@gmail.com>
|
Hi @mchurchward, it's great to have this feature merged. Would there be any issue if we backport this to the |
|
You can do that for yours, sure. |
* Circumvent number on string error, resolves PoetOS#538. (PoetOS#563) * Add file question type Fix upload when several file upload questions are used. - Adjust siganture of methods to their parent - Limit the files to upload to one for each question - Use questionaire id for file draft area instead of question id in the questionaire. Fix handling of file uploads - allow upload of one file only. - new submit does not load previously existing files. Change refence of file.itemid to questionnaire_response_file.id update existing files.itemid to questionnaire_response_file.id Improvements to satisfy code checker. Make the file upload work with required setting, fix delete of records * Make sid public, because its already used via #[\AllowDynamicProperties] Fix cleanup of old file responses. Add backup/restore handling for file response type. * Fix restore of files in backup. --------- Co-authored-by: Luca Bösch <luca.boesch@bfh.ch> Co-authored-by: Laurent David <lmedavid@gmail.com>
* Circumvent number on string error, resolves PoetOS#538. (PoetOS#563) * Add file question type Fix upload when several file upload questions are used. - Adjust siganture of methods to their parent - Limit the files to upload to one for each question - Use questionaire id for file draft area instead of question id in the questionaire. Fix handling of file uploads - allow upload of one file only. - new submit does not load previously existing files. Change refence of file.itemid to questionnaire_response_file.id update existing files.itemid to questionnaire_response_file.id Improvements to satisfy code checker. Make the file upload work with required setting, fix delete of records * Make sid public, because its already used via #[\AllowDynamicProperties] Fix cleanup of old file responses. Add backup/restore handling for file response type. * Fix restore of files in backup. --------- Co-authored-by: Luca Bösch <luca.boesch@bfh.ch> Co-authored-by: Laurent David <lmedavid@gmail.com>
File type question (PoetOS#681)
|
Hi, thank you for this. After an update, a database error appears on the questionnaire preview page. The table "questionnaire_response_file" is missing. When updating from a version greater than 2023101500 the table "questionnaire_response_file" will not be created. See https://github.com/PoetOS/moodle-mod_questionnaire/blob/MOODLE_500_STABLE/db/upgrade.php#L1032 |
Yep. Looks like the version merge didn't get done correctly. I have created issue 707 to deal with this. |
* Circumvent number on string error, resolves #538. (#563) * Add file question type Fix upload when several file upload questions are used. - Adjust siganture of methods to their parent - Limit the files to upload to one for each question - Use questionaire id for file draft area instead of question id in the questionaire. Fix handling of file uploads - allow upload of one file only. - new submit does not load previously existing files. Change refence of file.itemid to questionnaire_response_file.id update existing files.itemid to questionnaire_response_file.id Improvements to satisfy code checker. Make the file upload work with required setting, fix delete of records * Make sid public, because its already used via #[\AllowDynamicProperties] Fix cleanup of old file responses. Add backup/restore handling for file response type. * Fix restore of files in backup. --------- Co-authored-by: Luca Bösch <luca.boesch@bfh.ch> Co-authored-by: Laurent David <lmedavid@gmail.com>
Hi Mike,
this is the next attempt to open a pull request for the file type response. This will replace PR #599 (which I can try to close after creating this one).
The original work was done by Laurent David. He introduced this question/response type and also created PR #471. Luca Bösch added some tests. I completed the work.
There is code for backup and restore (as requested from you the last time).
I rebased it on the MOODLE_500_STABLE branch.
This PR also contains two changes unrelated to that feature but that are fixing two issues we had in the past and that are missing in the current MOODLE_500_STABLE branch.
Best regards, Stephan