Hi,
I believe I have found a bug with Totara relating to marking + course set completion + messaging.
When marking a quiz that would result in a person completing a course set, a database error is thrown if you happen to have a “Course Set Completed” message setup for the Program.
This is with Totara 2.5.7.
Steps to reproduce:
1) Create 2 courses X and Y
2) Now add a quiz to course X with 1 essay question in it worth 10 points
3) Create a Program A, and add X as a course set. Now add Y as a second course set, so that X needs to be completed so that Y will be available.
4) Now while still editing the Program go to the Messages tab and add a “Course Set Completed” message.
5) Assign user “Bob” to the Program as an individual.
6) Now log in as Bob, and take the quiz
7) Now log back in as an admin, and navigate to the quiz
8) Click Results -> Manual Grading, and click “grade” in the “To Grade” column
9) Attempt to give the question 10 points, and click “Save”
10) A “Database Transaction Error” is displayed.
With development debugging turned on, the stack trace is:
Debug info: This code can not be excecuted in transaction
Error code: dmltransactionexception
Stack trace:
line 2309 of /lib/dml/moodle_database.php: dml_transaction_exception thrown
line 61 of /lib/messagelib.php: call to moodle_database->transactions_forbidden()
line 209 of /totara/message/messagelib.php: call to message_send()
line 317 of /totara/message/messagelib.php: call to tm_message_send()
line 542 of /totara/program/program_message.class.php: call to tm_alert_send()
line 1158 of /totara/program/lib.php: call to prog_noneventbased_message->send_message()
line ? of unknownfile: call to prog_eventhandler_courseset_completed()
line 299 of /lib/eventslib.php: call to call_user_func()
line 521 of /lib/eventslib.php: call to events_dispatch()
line 233 of /totara/program/program_courseset.class.php: call to events_trigger()
line 760 of /totara/program/program_courseset.class.php: call to course_set->update_courseset_complete()
line 1514 of /totara/program/lib.php: call to multi_course_set->check_courseset_complete()
line 322 of /completion/completion_completion.php: call to prog_update_completion()
line 531 of /completion/completion_completion.php: call to completion_completion->mark_complete()
line 244 of /completion/completion_completion.php: call to completion_completion->aggregate()
line 129 of /completion/completion_criteria_completion.php: call to completion_completion->mark_inprogress()
line 121 of /completion/criteria/completion_criteria_grade.php: call to completion_criteria_completion->mark_complete()
line 264 of /completion/completion_criteria_completion.php: call to completion_criteria_grade->review()
line ? of unknownfile: call to completion_handle_criteria_course_calc()
line 299 of /lib/eventslib.php: call to call_user_func()
line 521 of /lib/eventslib.php: call to events_dispatch()
line 814 of /lib/grade/grade_grade.php: call to events_trigger()
line 263 of /lib/grade/grade_object.php: call to grade_grade->notify_changed()
line 771 of /lib/grade/grade_grade.php: call to grade_object->update()
line 624 of /lib/grade/grade_category.php: call to grade_grade->update()
line 511 of /lib/grade/grade_category.php: call to grade_category->aggregate_grades()
line 678 of /lib/grade/grade_item.php: call to grade_category->generate_grades()
line 1073 of /lib/gradelib.php: call to grade_item->regrade_final_grades()
line 1722 of /lib/grade/grade_item.php: call to grade_regrade_final_grades()
line 284 of /lib/gradelib.php: call to grade_item->update_raw_grade()
line 764 of /mod/quiz/lib.php: call to grade_update()
line 622 of /mod/quiz/lib.php: call to quiz_grade_item_update()
line 569 of /mod/quiz/locallib.php: call to quiz_update_grades()
line 1355 of /mod/quiz/attemptlib.php: call to quiz_save_best_grade()
line 488 of /mod/quiz/report/grading/report.php: call to quiz_attempt->process_submitted_actions()
line 111 of /mod/quiz/report/grading/report.php: call to quiz_grading_report->process_submitted_data()
line 100 of /mod/quiz/report.php: call to quiz_grading_report->display()
Note that if I then remove the Course Set Complete message, I am able to mark the quiz.
Let me know if you can take a look at this and if you can successfully reproduce the problem.