cbluesprl / moodle-quiz_export

This plugin allows you to export quiz attempts in pdf format
3 stars 3 forks source link

Attempt to access the step user before it was initialised. #12

Closed sbt-sysadmin closed 1 week ago

sbt-sysadmin commented 1 month ago

Moodle 4.3.4+ (Build: 20240530) | main moodle-quiz_export branch.

Able to export one Quiz attempt at a time, but have to click on Show report button before each export of a single Quiz attempt.

When attempting to export multiple Quiz attempts, I am presented with a confirmation window asking if I want to export selected attempts.

When I click on Yes, I see this error message:

Attempt to access the step user before it was initialised. Did you forget to call question_usage_by_activity::preload_all_step_users() or similar?

line 204 of /question/engine/questionattemptstep.php: call to debugging() line 215 of /question/engine/questionattemptstep.php: call to question_attempt_step->get_user() line 524 of /question/engine/renderer.php: call to question_attempt_step->get_user_fullname() line 495 of /question/engine/renderer.php: call to core_question_renderer->action_author() line 120 of /question/engine/renderer.php: call to core_question_renderer->response_history() line 113 of /question/behaviour/behaviourbase.php: call to core_question_renderer->question() line 912 of /question/engine/questionattempt.php: call to question_behaviour->render() line 483 of /question/engine/questionusage.php: call to question_attempt->render() line 1345 of /mod/quiz/classes/quiz_attempt.php: call to question_usage_by_activity->render_question() line 1307 of /mod/quiz/classes/quiz_attempt.php: call to mod_quiz\quiz_attempt->render_question_helper() line 199 of /mod/quiz/classes/output/renderer.php: call to mod_quiz\quiz_attempt->render_question() line 67 of /mod/quiz/classes/output/renderer.php: call to mod_quiz\output\renderer->questions() line 314 of /mod/quiz/report/export/export.php: call to mod_quiz\output\renderer->review_page() line 270 of /mod/quiz/report/export/export.php: call to quiz_export_engine->render() line 250 of /mod/quiz/report/export/export.php: call to quiz_export_engine->get_review_html() line 107 of /mod/quiz/report/export/export.php: call to quiz_export_engine->all_questions() line 198 of /mod/quiz/report/export/report.php: call to quiz_export_engine->a2pdf() line 164 of /mod/quiz/report/export/report.php: call to quiz_export_report->export_attempts() line 86 of /mod/quiz/report/export/report.php: call to quiz_export_report->process_actions() line 83 of /mod/quiz/report.php: call to quiz_export_report->display()

-=-

shenrard commented 1 month ago

Hi there,

Thank you for reporting this issue. I tried to reproduce the problem using a simple quiz with a true/false question, but I wasn't able to encounter the same issue during export.

Could you please provide more details about the quiz you're working with? For example:

Apologies for the inconvenience, and we'll do our best to resolve this as quickly as possible.

Thank you!

sbt-sysadmin commented 2 weeks ago

I took a look at the ZipArchive class reference manual and wanted to note that I am running PHP8.1- not 8.0.

https://github.com/PHPOffice/PHPWord/issues/2187

1) 20 Short-Answer Questions. Have tried various courses with different numbers of questions.

2) I have all Quiz settings set to default.

3a) Click on checkmark next to usernames under Quiz - Results - Quiz exporting. 3b) Scroll down to bottom and click on Export selected attempts. 3c) When Confirmation dialog (Export selected attempts?) appears, click on Yes.

4) I have checked various /var/log files, but have found nothing related to the error I detailed in original issue submission.

Thank you.

Trolli07 commented 2 weeks ago

Hello,

We can't reproduce the bug. However, Moodle says to call a function and I've added this call.

I've pushed in the MOODLE_4X branch

Is it better for you ?

Kind regards,

Olivier

sbt-sysadmin commented 2 weeks ago

Yes! Great job.

Works perfectly now with the changes you made.

This will save us roughly 30 hours of work.

Thank you so much!