## Activities: Question Practice

mod_qpractice
Maintained by Marcus Green
A teacher sets up a bank of questions organised into categories. Then the student can then choose what categories they want to practice when.
79 sites
17 fans
Moodle 2.7, 2.8, 2.9, 3.0, 3.1, 3.2

This activity uses the standard Moodle question types (plus several third party question types). A teacher can set up categories for students to select from and they can practice on their own. It works best with a fairly large bank of questions.

It is possible to experience it from a student point of view at this site

### Contributors

Jayesh Anandani: Former maintainer
Tim Hunt: Former maintainer
Jean-Michel Védrine: Former maintainer

### Awards

• Thu, 12 Sep 2013, 12:33 AM
Tim - I am still getting an error:

[Wed Sep 11 09:13:10 2013] [error] [client 127.0.0.1] PHP Notice: Undefined property: stdClass::$categories in /var/www/m25/mod/qpractice/locallib.php on line 71, referer: http://localhost/m25/mod/qpractice/startattempt.php?id=594 [Wed Sep 11 09:13:10 2013] [error] [client 127.0.0.1] Default exception handler: Error writing to database Debug: Column 'categoryid' cannot be null\nINSERT INTO mdl_qpractice_session (time,goalpercentage,noofquestions,practicedate,typeofpractice,categoryid,userid,qpracticeid,questionusageid) VALUES(?,?,?,?,?,?,?,?,?)\n[array (\n 0 => NULL,\n 1 => NULL,\n 2 => NULL,\n 3 => 1378908790,\n 4 => '1',\n 5 => NULL,\n 6 => '2',\n 7 => 1,\n 8 => 12,\n)]\nError code: dmlwriteexception\n* line 426 of /lib/dml/moodle_database.php: dml_write_exception thrown\n* line 1089 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()\n* line 1131 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()\n* line 78 of /mod/qpractice/locallib.php: call to mysqli_native_moodle_database->insert_record()\n* line 71 of /mod/qpractice/startattempt.php: call to qpractice_session_create()\n, referer: http://localhost/m25/mod/qpractice/startattempt.php?id=594 I took a quick look and am wondering if we aren't sending the wrong context to populate categories:$context = context_module::instance($cm->id);$behaviours=get_options_behaviour($cm);$categories = $DB->get_records_menu('question_categories', array('contextid'=>$context->id, 'parent'=>0), 'name', 'id, name');

It looks like we are sending the course module context id and I thought that the question_categories table stored the course context id. As a result I am getting an empty array of question categories. I also found myself wondering about the need for the parent=0 condition. Is the intention here to generate a list of all the question categories for the course?

Peace - Anthony
• Thu, 12 Sep 2013, 1:09 AM
p.s. - I added/modified the following lines and it seemed to work the way that I would expect:

$coursecontext = context_course::instance($course->id);
$categories =$DB->get_records_menu('question_categories', array('contextid'=>$coursecontext->id), 'name', 'id, name'); • Thu, 12 Sep 2013, 1:13 AM No. It is module context by design. That is how the teacher controls which questions are available for practice. They move or copy them into that context. It is also intentional that we only offer a choice of top-level categories in the UI (though that decision might get reviewed.) • Thu, 12 Sep 2013, 1:40 AM Ah, I see the problem: 1. Create a new practice. 2. Don't add any questions to the question bank. 3. Click the Create a new session link. Actual result: You get the start session form with an empty Categories drop-down. Expected result: The Create a new session link should now appear if there are no questions in the question bank yet. Instead we should display a message something like "No questions have been added to the question bank yet." • Thu, 12 Sep 2013, 4:13 AM Tim - OK, now I understand how it is designed to work. I had not noticed the additional default question category for the qpractice activity. I think what is unclear is when or where to add questions or select the category. There is not a place on the initial creation of the qpractice to do so, perhaps that might be added or perhaps the next step would be to take the user to the question bank page for the activity (for example, http://localhost/m25/question/edit.php?cmid=596). The current flow seems to allow you to create a qpractice and then the only options are to start a session or review. Perhaps if the user has the capability to add questions we might add a link to the question bank to the question bank edit page. At some point, I suspect teachers will want to be able to review the sessions of the students too. In any case, I understand what was causing the error and I think it can be improved. Some confusion may arise from the distinction between the qpractice activity's question bank and the course's question bank. We may want to think about how to make that distinction apparent to the user. Peace - Anthony • Thu, 12 Sep 2013, 4:18 AM Thanks for helping me to understand how this works. I'm going to go ahead and approve this now that the URLs are available and it is generally working. It would be good if we could take care of adding release and maturity variables to version.php for the next version added to Moodle plugins. Peace - Anthony • Wed, 18 Dec 2013, 5:27 AM Nice contribution guys, I've been using it heavily. I thought it would be nice if we could control the order in which questions are shown to student so i made some mods to it. I also combined the create session and session history pages to simplify it a bit. I'd like to contribute to this project, so if you think any of this is of value let me know. I've fixed the upgrade.php install.xml etc so it does a clean install. Luck++ • Fri, 20 Dec 2013, 10:57 PM Hello Carl LeBlond, First of all thank you for using Qpractice module.It was good to hear that the module was of great use to you. I am quite new to open source, so while it is great you want to contribute, i am not very experienced at recieving contributions, so please be patient. The whole idea of module is to ask random questions to students. If we were to control the questions being asked then it will be almost similar to Quiz module.We are working on algorithm that will ask questions randomly but in an efficient manner. • Mon, 15 Dec 2014, 10:39 PM Greetings, please do you plan to adapt Qpractice module for Moodle 2.7/2.8 ? Best, Miro • Thu, 17 Mar 2016, 12:40 AM Hi Marcus. May I suggest to extend a bit the plugin description here and add more screenshots that would better illustrate the student's workflow. • Thu, 17 Mar 2016, 1:27 AM OK, I will add some more images and description. • Thu, 30 Jun 2016, 8:09 PM Hi, I'm having trouble installing. I'm getting an error when I try to validate. It says "Validating mod_qpractice" . . . Error. [OK] Name of the plugin to be installed [qpractice] (?) [Error] Unsupported syntax detected in version.php file [$module].
Installation aborted due to validation failure.

Tip?
• Thu, 30 Jun 2016, 8:10 PM
How are you installing it and on what version of Moodle. That sounds like you may have the files in the wrong folder
• Fri, 1 Jul 2016, 10:58 AM
Hi Marcus,
My moodle version is
\$version = 2016052300.00; // 20160523 = branching date YYYYMMDD - do
I installed that Monday.

I attempted to install Qpractice by clicking "install now" from model org. ( Specifically https://moodle.org/plugins/report/index.php?report=user_sites&pluginid=831 )

I did a double upgrade on Monday because I had to go from 2.5.?? to 2.7.?? before I could go to 3.1, so it is possible I have files wrong. Is there someplace I can go hunting?
• Tue, 5 Jul 2016, 10:54 PM
Hi Lucia, did you get it working? If not email me directly at marcusavgreen at gmail.com
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.24764452874660492, "perplexity": 6495.7194196155515}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-47/segments/1542039743732.41/warc/CC-MAIN-20181117185331-20181117211331-00291.warc.gz"}