justinhunt / moodle-assign_submission_onlinepoodll Goto Github PK
View Code? Open in Web Editor NEWThe PoodLL assignment submission plugin for Moodle 2.3 and above
The PoodLL assignment submission plugin for Moodle 2.3 and above
Hi there,
It seems Online PoodLL submissions are lost in the course/activity restoration process.
Here are the steps to reproduce :
I checked the PoodLL feedback plugin, and everything works fine there!
Also, the tests were made with Moodle 2.5.
Great plugin by the way! Very useful to us!
Jean-Philippe
Online Poodll submissions
Release 3.1.7 (Build 2021022800)
We are encountering an issue in safari with the latest release.
Tested on
Safari Version 14.0.3 (15610.4.3.1.6, 15610)
macOS Catalina Version 10.15.7 (19H512)
Hi, some teachers have reported a strange bug where they cannot save an assignment in Moodle. This bug seemed to appear randomly after editing some h5p content. It affects only one teacher. Other teachers can save the same assignment. Here is a forum which discuss the bug in more details.
https://moodle.org/mod/forum/discuss.php?d=424457
After much investigation, I was able to reproduce it and debug to see what was going on. What I found was that the plugin assignsubmission_onlinepoodll has a filemanager type element called "backimage". When saving an assignment which has no backimage such as a new assignment for example and when the "Online Poodll" submission type is not selected, the backimage element is hidden and it is assigned a null default value. Then, when Moodle comes to validate the form it checks the number of draft files assigned to this element VS the maximum number of authorized files which is 1 in this case. The DB request checks in the mdl_files table in search for the draft files which it thinks are associated with this element based on the user context (which is why it affects only one user) and the itemid which it takes from the value of the filemanager element. Since our value is null (0) then all draft files from this particular user with an itemid = 0 are considered as backimages then the error message appear and the assignment cannot be saved. We have to select the "Online Poodll" submission type to see the message since the backimage element is hidden.
My understanding is that the "backimage" element should be assigned a value given by the Moodle function file_get_unused_draft_itemid() which is how the toHtml() function of the filemanager element use to
assign an id to the element when it is rendered. That explains why the bug only happens when the backimage element is hidden. This value would then be used by Moodle to look for the right draft file with
itemid = element value.
Also the reason why this bug was going away on its own is that Moodle periodically delete old draft files in a cron job.
Error preventing the save of the assignment
Some draft files with itemid 0 created by core_h5p for the user context
Moodle filemanager element maxfiles validation. It looks for all draft files in the current user context with itemid = $element->getValue()
OnlinePoodll get_settings function set the default value for backimage element to $backimage which is null if no entry exists in the mdl_assign_plugin_config for this assignement and onlinepoodll plugin. The element value is then 0.
I tried to insert this code in locallib.php line 107 just under $backimage = $this->get_config('backimage'); to see if it would fix the bug and it does. But I'm not sure if its the way to do it...
if(empty($backimage)) { require_once("$CFG->libdir/filelib.php"); $backimage = file_get_unused_draft_itemid(); }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.