From 80ad6fb45f9420bebe9c28d6d4519048560b9d42 Mon Sep 17 00:00:00 2001 From: Mahmoud Kassaei Date: Thu, 17 Mar 2022 09:30:29 +0000 Subject: [PATCH] Quiz answer sheets: Update to work with Moodle 4.0 #547717 --- .github/workflows/ci.yml | 10 +--------- amd/build/create_attempt_dialog.min.js | 1 - amd/build/create_attempt_dialog.min.js.map | 2 +- amd/build/print.min.js | 2 +- amd/build/print.min.js.map | 2 +- amd/build/submit_student_responses.min.js | 2 +- amd/build/submit_student_responses.min.js.map | 2 +- amd/src/create_attempt_dialog.js | 1 - amd/src/print.js | 2 +- amd/src/submit_student_responses.js | 2 +- changes.md | 5 +++++ classes/external.php | 2 +- tests/behat/attempt_and_answer_sheet.feature | 6 ++---- tests/behat/attempt_sheet_for_dropdown.feature | 5 ++--- tests/behat/basic.feature | 3 +-- tests/behat/submit_student_responses.feature | 6 ++---- version.php | 6 +++--- 17 files changed, 24 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 881bd10..59b3468 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,18 +8,12 @@ jobs: fail-fast: false matrix: include: - - php: '7.5' + - php: '7.4' moodle-branch: 'master' database: 'pgsql' - php: '7.4' moodle-branch: 'MOODLE_311_STABLE' database: 'mariadb' - - php: '7.3' - moodle-branch: 'MOODLE_310_STABLE' - database: 'pgsql' - - php: '7.2' - moodle-branch: 'MOODLE_39_STABLE' - database: 'mariadb' services: postgres: @@ -52,8 +46,6 @@ jobs: - name: Install node uses: actions/setup-node@v1 - with: - node-version: '14.15.0' - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/amd/build/create_attempt_dialog.min.js b/amd/build/create_attempt_dialog.min.js index fa11ea4..5e78615 100644 --- a/amd/build/create_attempt_dialog.min.js +++ b/amd/build/create_attempt_dialog.min.js @@ -2,7 +2,6 @@ * JavaScript for the create_attempt_dialog class. * * @module quiz_answersheets/create_attempt_dialog - * @package quiz_answersheets * @copyright 2019 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/amd/build/create_attempt_dialog.min.js.map b/amd/build/create_attempt_dialog.min.js.map index b7b8893..7548274 100644 --- a/amd/build/create_attempt_dialog.min.js.map +++ b/amd/build/create_attempt_dialog.min.js.map @@ -1 +1 @@ -{"version":3,"file":"create_attempt_dialog.min.js","sources":["../src/create_attempt_dialog.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * JavaScript for the create_attempt_dialog class.\n *\n * @module quiz_answersheets/create_attempt_dialog\n * @package quiz_answersheets\n * @copyright 2019 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/ajax', 'core/notification'],\n function($, ModalFactory, ModalEvents, Ajax, Notification) {\n var t = {\n SELECTOR: '.create-attempt-btn',\n init: function() {\n $(t.SELECTOR).click(function(e) {\n e.preventDefault();\n var target = $(this).closest('table').find('button');\n t.disableButton(target, true);\n var message = $(this).data('message');\n var modalButton = M.util.get_string('create_attempt_modal_button', 'quiz_answersheets');\n var params = {\n quizid: $(this).data('quiz-id'),\n userid: $(this).data('user-id'),\n url: $(this).data('url')\n };\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: M.util.get_string('create_attempt_modal_title', 'quiz_answersheets'),\n body: message\n }).done(function(modal) {\n modal.setSaveButtonText(modalButton);\n modal.getRoot().on(ModalEvents.save, params, t.createAttempt);\n modal.show();\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, modal, t.closeModal);\n return modal;\n }).catch(function(err) {\n t.exceptionHandler(err, target);\n });\n });\n },\n closeModal: function(e) {\n var modal = e.data;\n var target = $(t.SELECTOR).closest('table').find('button');\n modal.destroy();\n t.disableButton(target, false);\n },\n createAttempt: function(e) {\n e.preventDefault();\n var data = e.data;\n var modalButtons = $(e.target).find('button');\n t.disableButton(modalButtons, true);\n var promises = Ajax.call([{\n methodname: 'quiz_answersheets_create_attempt',\n args: {\n quizid: data.quizid,\n userid: data.userid\n }\n }]);\n // Handle promise.\n promises[0].then(function(res) {\n var id = res.id || '';\n window.location.href = t.updateQueryStringParameter(data.url, 'lastchanged', id);\n return true;\n }).fail(function(err) {\n t.exceptionHandler(err, modalButtons);\n });\n },\n disableButton: function(el, status) {\n el.prop(\"disabled\", status);\n },\n exceptionHandler: function(ex, el) {\n Notification.exception(ex);\n t.disableButton(el, false);\n },\n updateQueryStringParameter: function(uri, key, value) {\n var re = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\");\n var separator = uri.indexOf('?') !== -1 ? \"&\" : \"?\";\n if (uri.match(re)) {\n return uri.replace(re, '$1' + key + \"=\" + value + '$2');\n } else {\n return uri + separator + key + \"=\" + value;\n }\n }\n };\n return t;\n });\n"],"names":["define","$","ModalFactory","ModalEvents","Ajax","Notification","t","SELECTOR","init","click","e","preventDefault","target","this","closest","find","disableButton","message","data","modalButton","M","util","get_string","params","quizid","userid","url","create","type","types","SAVE_CANCEL","title","body","done","modal","setSaveButtonText","getRoot","on","save","createAttempt","show","hidden","closeModal","catch","err","exceptionHandler","destroy","modalButtons","call","methodname","args","then","res","id","window","location","href","updateQueryStringParameter","fail","el","status","prop","ex","exception","uri","key","value","re","RegExp","separator","indexOf","match","replace"],"mappings":";;;;;;;;AAuBAA,iDAAO,CAAC,SAAU,qBAAsB,oBAAqB,YAAa,sBACtE,SAASC,EAAGC,aAAcC,YAAaC,KAAMC,kBACrCC,EAAI,CACJC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,KACbtC,EAAEuC,iBAAiBD,IAAKG,kBAGhC/B,cAAe,SAAS2C,GAAIC,QACxBD,GAAGE,KAAK,WAAYD,SAExBf,iBAAkB,SAASiB,GAAIH,IAC3BtD,aAAa0D,UAAUD,IACvBxD,EAAEU,cAAc2C,IAAI,IAExBF,2BAA4B,SAASO,IAAKC,IAAKC,WACvCC,GAAK,IAAIC,OAAO,SAAWH,IAAM,YAAa,KAC9CI,WAAkC,IAAtBL,IAAIM,QAAQ,KAAc,IAAM,WAC5CN,IAAIO,MAAMJ,IACHH,IAAIQ,QAAQL,GAAI,KAAOF,IAAM,IAAMC,MAAQ,MAE3CF,IAAMK,UAAYJ,IAAM,IAAMC,eAI1C5D"} \ No newline at end of file +{"version":3,"file":"create_attempt_dialog.min.js","sources":["../src/create_attempt_dialog.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * JavaScript for the create_attempt_dialog class.\n *\n * @module quiz_answersheets/create_attempt_dialog\n * @copyright 2019 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/ajax', 'core/notification'],\n function($, ModalFactory, ModalEvents, Ajax, Notification) {\n var t = {\n SELECTOR: '.create-attempt-btn',\n init: function() {\n $(t.SELECTOR).click(function(e) {\n e.preventDefault();\n var target = $(this).closest('table').find('button');\n t.disableButton(target, true);\n var message = $(this).data('message');\n var modalButton = M.util.get_string('create_attempt_modal_button', 'quiz_answersheets');\n var params = {\n quizid: $(this).data('quiz-id'),\n userid: $(this).data('user-id'),\n url: $(this).data('url')\n };\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: M.util.get_string('create_attempt_modal_title', 'quiz_answersheets'),\n body: message\n }).done(function(modal) {\n modal.setSaveButtonText(modalButton);\n modal.getRoot().on(ModalEvents.save, params, t.createAttempt);\n modal.show();\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, modal, t.closeModal);\n return modal;\n }).catch(function(err) {\n t.exceptionHandler(err, target);\n });\n });\n },\n closeModal: function(e) {\n var modal = e.data;\n var target = $(t.SELECTOR).closest('table').find('button');\n modal.destroy();\n t.disableButton(target, false);\n },\n createAttempt: function(e) {\n e.preventDefault();\n var data = e.data;\n var modalButtons = $(e.target).find('button');\n t.disableButton(modalButtons, true);\n var promises = Ajax.call([{\n methodname: 'quiz_answersheets_create_attempt',\n args: {\n quizid: data.quizid,\n userid: data.userid\n }\n }]);\n // Handle promise.\n promises[0].then(function(res) {\n var id = res.id || '';\n window.location.href = t.updateQueryStringParameter(data.url, 'lastchanged', id);\n return true;\n }).fail(function(err) {\n t.exceptionHandler(err, modalButtons);\n });\n },\n disableButton: function(el, status) {\n el.prop(\"disabled\", status);\n },\n exceptionHandler: function(ex, el) {\n Notification.exception(ex);\n t.disableButton(el, false);\n },\n updateQueryStringParameter: function(uri, key, value) {\n var re = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\");\n var separator = uri.indexOf('?') !== -1 ? \"&\" : \"?\";\n if (uri.match(re)) {\n return uri.replace(re, '$1' + key + \"=\" + value + '$2');\n } else {\n return uri + separator + key + \"=\" + value;\n }\n }\n };\n return t;\n });\n"],"names":["define","$","ModalFactory","ModalEvents","Ajax","Notification","t","SELECTOR","init","click","e","preventDefault","target","this","closest","find","disableButton","message","data","modalButton","M","util","get_string","params","quizid","userid","url","create","type","types","SAVE_CANCEL","title","body","done","modal","setSaveButtonText","getRoot","on","save","createAttempt","show","hidden","closeModal","catch","err","exceptionHandler","destroy","modalButtons","call","methodname","args","then","res","id","window","location","href","updateQueryStringParameter","fail","el","status","prop","ex","exception","uri","key","value","re","RegExp","separator","indexOf","match","replace"],"mappings":";;;;;;;AAsBAA,iDAAO,CAAC,SAAU,qBAAsB,oBAAqB,YAAa,sBACtE,SAASC,EAAGC,aAAcC,YAAaC,KAAMC,kBACrCC,EAAI,CACJC,SAAU,sBACVC,KAAM,WACFP,EAAEK,EAAEC,UAAUE,OAAM,SAASC,GACzBA,EAAEC,qBACEC,OAASX,EAAEY,MAAMC,QAAQ,SAASC,KAAK,UAC3CT,EAAEU,cAAcJ,QAAQ,OACpBK,QAAUhB,EAAEY,MAAMK,KAAK,WACvBC,YAAcC,EAAEC,KAAKC,WAAW,8BAA+B,qBAC/DC,OAAS,CACTC,OAAQvB,EAAEY,MAAMK,KAAK,WACrBO,OAAQxB,EAAEY,MAAMK,KAAK,WACrBQ,IAAKzB,EAAEY,MAAMK,KAAK,QAEtBhB,aAAayB,OAAO,CAChBC,KAAM1B,aAAa2B,MAAMC,YACzBC,MAAOX,EAAEC,KAAKC,WAAW,6BAA8B,qBACvDU,KAAMf,UACPgB,MAAK,SAASC,cACbA,MAAMC,kBAAkBhB,aACxBe,MAAME,UAAUC,GAAGlC,YAAYmC,KAAMf,OAAQjB,EAAEiC,eAC/CL,MAAMM,OAENN,MAAME,UAAUC,GAAGlC,YAAYsC,OAAQP,MAAO5B,EAAEoC,YACzCR,SACRS,OAAM,SAASC,KACdtC,EAAEuC,iBAAiBD,IAAKhC,eAIpC8B,WAAY,SAAShC,OACbwB,MAAQxB,EAAEQ,KACVN,OAASX,EAAEK,EAAEC,UAAUO,QAAQ,SAASC,KAAK,UACjDmB,MAAMY,UACNxC,EAAEU,cAAcJ,QAAQ,IAE5B2B,cAAe,SAAS7B,GACpBA,EAAEC,qBACEO,KAAOR,EAAEQ,KACT6B,aAAe9C,EAAES,EAAEE,QAAQG,KAAK,UACpCT,EAAEU,cAAc+B,cAAc,GACf3C,KAAK4C,KAAK,CAAC,CACtBC,WAAY,mCACZC,KAAM,CACF1B,OAAQN,KAAKM,OACbC,OAAQP,KAAKO,WAIZ,GAAG0B,MAAK,SAASC,SAClBC,GAAKD,IAAIC,IAAM,UACnBC,OAAOC,SAASC,KAAOlD,EAAEmD,2BAA2BvC,KAAKQ,IAAK,cAAe2B,KACtE,KACRK,MAAK,SAASd,KACbtC,EAAEuC,iBAAiBD,IAAKG,kBAGhC/B,cAAe,SAAS2C,GAAIC,QACxBD,GAAGE,KAAK,WAAYD,SAExBf,iBAAkB,SAASiB,GAAIH,IAC3BtD,aAAa0D,UAAUD,IACvBxD,EAAEU,cAAc2C,IAAI,IAExBF,2BAA4B,SAASO,IAAKC,IAAKC,WACvCC,GAAK,IAAIC,OAAO,SAAWH,IAAM,YAAa,KAC9CI,WAAkC,IAAtBL,IAAIM,QAAQ,KAAc,IAAM,WAC5CN,IAAIO,MAAMJ,IACHH,IAAIQ,QAAQL,GAAI,KAAOF,IAAM,IAAMC,MAAQ,MAE3CF,IAAMK,UAAYJ,IAAM,IAAMC,eAI1C5D"} \ No newline at end of file diff --git a/amd/build/print.min.js b/amd/build/print.min.js index f83e5b2..3cc3478 100644 --- a/amd/build/print.min.js +++ b/amd/build/print.min.js @@ -1,7 +1,7 @@ /** * Javascript for print event. * - * @package quiz_answersheets + * @module quiz_answersheets/print * @copyright 2019 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/amd/build/print.min.js.map b/amd/build/print.min.js.map index 2b81b64..a8759de 100644 --- a/amd/build/print.min.js.map +++ b/amd/build/print.min.js.map @@ -1 +1 @@ -{"version":3,"file":"print.min.js","sources":["../src/print.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript for print event.\n *\n * @package quiz_answersheets\n * @copyright 2019 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) {\n\n var t = {\n\n /**\n * Server side config.\n */\n mconfig: null,\n\n /**\n * CSS Selector.\n */\n SELECTOR: {\n PAGE_HEADER: '.attempt-sheet-header-gecko',\n PAGE_CONTAINER: '#page',\n QTYPE_ORDERING_VERTICAL_SORTABLE_LIST: '.que.ordering ul.sortablelist.vertical li',\n QTYPE_ORDERING_HORIZONTAL_SORTABLE_LIST: '.que.ordering ul.sortablelist.horizontal li',\n QTYPE_ORDERING_MARGIN: '.orderingmargin'\n },\n\n /**\n * Template.\n */\n TEMPLATE: {\n QTYPE_ORDERING_MARGIN: '
',\n QTYPE_ORDERING_WRAPPER: '
'\n },\n\n /**\n * Page header height.\n */\n pageHeaderHeight: 0,\n\n /**\n * Page container.\n */\n pageContainer: null,\n\n /**\n * Page Header element\n */\n pageHeader: null,\n\n\n /**\n * Initialise function\n * @param {object} options Options for ajax request\n */\n init: function(options) {\n t.mconfig = options;\n t.pageHeader = $(t.SELECTOR.PAGE_HEADER);\n t.pageContainer = $(t.SELECTOR.PAGE_CONTAINER);\n t.pageHeaderHeight = t.pageHeader.height();\n\n // Set the correct position for page header.\n t.pageHeader.css('top', -Math.abs(t.pageHeaderHeight));\n // Set the space fof page header.\n t.pageContainer.css('margin-top', t.pageHeaderHeight);\n\n window.addEventListener('beforeprint', t.handlePrintStart);\n window.addEventListener('afterprint', t.handlePrintStop);\n },\n\n /**\n * Handle print start event.\n *\n * @param {Event} e\n */\n handlePrintStart: function(e) {\n e.preventDefault();\n t.pageContainer.css('margin-top', 0);\n if (Y.UA.gecko) {\n t.pageContainer.css('padding-top', t.pageHeaderHeight + 30);\n t.pageHeader.css('top', 0);\n }\n\n t.handlePrintForOrdering(true);\n\n var promises = Ajax.call([{\n methodname: 'quiz_answersheets_create_event',\n args: {\n attemptid: t.mconfig.attemptid,\n userid: t.mconfig.userid,\n courseid: t.mconfig.courseid,\n cmid: t.mconfig.cmid,\n quizid: t.mconfig.quizid,\n pagetype: t.mconfig.pagetype\n }\n }]);\n // Handle promise.\n promises[0].then(function() {\n return true;\n }).fail(function(err) {\n Notification.exception(err);\n });\n },\n\n /**\n * Handle print stop event.\n *\n * @param {Event} e\n * @returns {boolean}\n */\n handlePrintStop: function(e) {\n e.preventDefault();\n t.pageContainer.css('margin-top', t.pageHeaderHeight);\n if (Y.UA.gecko) {\n t.pageContainer.css('padding-top', 0);\n t.pageHeader.css('top', -Math.abs(t.pageHeaderHeight));\n }\n t.handlePrintForOrdering(false);\n return true;\n },\n\n /**\n * Handle print for Ordering question type.\n *\n * @param {boolean} isPrinting\n */\n handlePrintForOrdering: function(isPrinting) {\n var sortablesVertical = $(t.SELECTOR.QTYPE_ORDERING_VERTICAL_SORTABLE_LIST);\n var sortablesHorizontal = $(t.SELECTOR.QTYPE_ORDERING_HORIZONTAL_SORTABLE_LIST);\n if (sortablesVertical.length || sortablesHorizontal.length) {\n if (isPrinting) {\n sortablesVertical.each(function(i, nodeSortableVertical) {\n // We already removed all the margin and padding in the CSS.\n // So we need to add extra spacing here.\n var marginEle = $(t.TEMPLATE.QTYPE_ORDERING_MARGIN);\n $(nodeSortableVertical).before(marginEle);\n $(nodeSortableVertical).after(marginEle);\n });\n\n sortablesHorizontal.each(function(i, nodeSortableHorizontal) {\n // Horizontal ordering is different with vertical.\n // So we need to wrap the sortable with a wrapper and add extra spacing later.\n var marginEle = $(t.TEMPLATE.QTYPE_ORDERING_MARGIN);\n marginEle.addClass('horizontal');\n $(nodeSortableHorizontal).after(marginEle);\n $(nodeSortableHorizontal).wrap(t.TEMPLATE.QTYPE_ORDERING_WRAPPER);\n });\n } else {\n // Remove all the margin placeholder.\n $(t.SELECTOR.QTYPE_ORDERING_MARGIN).remove();\n if (sortablesHorizontal.length) {\n sortablesHorizontal.each(function(i, nodeSortableHorizontal) {\n // Remove the wrapper for horizontal sortable.\n $(nodeSortableHorizontal).unwrap();\n });\n }\n }\n }\n }\n\n };\n\n return t;\n});\n"],"names":["define","$","Ajax","Notification","t","mconfig","SELECTOR","PAGE_HEADER","PAGE_CONTAINER","QTYPE_ORDERING_VERTICAL_SORTABLE_LIST","QTYPE_ORDERING_HORIZONTAL_SORTABLE_LIST","QTYPE_ORDERING_MARGIN","TEMPLATE","QTYPE_ORDERING_WRAPPER","pageHeaderHeight","pageContainer","pageHeader","init","options","height","css","Math","abs","window","addEventListener","handlePrintStart","handlePrintStop","e","preventDefault","Y","UA","gecko","handlePrintForOrdering","call","methodname","args","attemptid","userid","courseid","cmid","quizid","pagetype","then","fail","err","exception","isPrinting","sortablesVertical","sortablesHorizontal","length","each","i","nodeSortableVertical","marginEle","before","after","nodeSortableHorizontal","addClass","wrap","remove","unwrap"],"mappings":";;;;;;;AAuBAA,iCAAO,CAAC,SAAU,YAAa,sBAAsB,SAASC,EAAGC,KAAMC,kBAE/DC,EAAI,CAKJC,QAAS,KAKTC,SAAU,CACNC,YAAa,8BACbC,eAAgB,QAChBC,sCAAuC,4CACvCC,wCAAyC,8CACzCC,sBAAuB,mBAM3BC,SAAU,CACND,sBAAuB,qCACvBE,uBAAwB,uCAM5BC,iBAAkB,EAKlBC,cAAe,KAKfC,WAAY,KAOZC,KAAM,SAASC,SACXd,EAAEC,QAAUa,QACZd,EAAEY,WAAaf,EAAEG,EAAEE,SAASC,aAC5BH,EAAEW,cAAgBd,EAAEG,EAAEE,SAASE,gBAC/BJ,EAAEU,iBAAmBV,EAAEY,WAAWG,SAGlCf,EAAEY,WAAWI,IAAI,OAAQC,KAAKC,IAAIlB,EAAEU,mBAEpCV,EAAEW,cAAcK,IAAI,aAAchB,EAAEU,kBAEpCS,OAAOC,iBAAiB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CpD,EAAEuD,wBAAwBE,KAAKtD,EAAEQ,SAASC,6BAI9CZ,EAAEG,EAAEE,SAASK,uBAAuBgD,SAChCX,oBAAoBC,QACpBD,oBAAoBE,MAAK,SAASC,EAAGK,wBAEjCvD,EAAEuD,wBAAwBI,uBAS3CxD"} \ No newline at end of file +{"version":3,"file":"print.min.js","sources":["../src/print.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript for print event.\n *\n * @module quiz_answersheets/print\n * @copyright 2019 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) {\n\n var t = {\n\n /**\n * Server side config.\n */\n mconfig: null,\n\n /**\n * CSS Selector.\n */\n SELECTOR: {\n PAGE_HEADER: '.attempt-sheet-header-gecko',\n PAGE_CONTAINER: '#page',\n QTYPE_ORDERING_VERTICAL_SORTABLE_LIST: '.que.ordering ul.sortablelist.vertical li',\n QTYPE_ORDERING_HORIZONTAL_SORTABLE_LIST: '.que.ordering ul.sortablelist.horizontal li',\n QTYPE_ORDERING_MARGIN: '.orderingmargin'\n },\n\n /**\n * Template.\n */\n TEMPLATE: {\n QTYPE_ORDERING_MARGIN: '
',\n QTYPE_ORDERING_WRAPPER: '
'\n },\n\n /**\n * Page header height.\n */\n pageHeaderHeight: 0,\n\n /**\n * Page container.\n */\n pageContainer: null,\n\n /**\n * Page Header element\n */\n pageHeader: null,\n\n\n /**\n * Initialise function\n * @param {object} options Options for ajax request\n */\n init: function(options) {\n t.mconfig = options;\n t.pageHeader = $(t.SELECTOR.PAGE_HEADER);\n t.pageContainer = $(t.SELECTOR.PAGE_CONTAINER);\n t.pageHeaderHeight = t.pageHeader.height();\n\n // Set the correct position for page header.\n t.pageHeader.css('top', -Math.abs(t.pageHeaderHeight));\n // Set the space fof page header.\n t.pageContainer.css('margin-top', t.pageHeaderHeight);\n\n window.addEventListener('beforeprint', t.handlePrintStart);\n window.addEventListener('afterprint', t.handlePrintStop);\n },\n\n /**\n * Handle print start event.\n *\n * @param {Event} e\n */\n handlePrintStart: function(e) {\n e.preventDefault();\n t.pageContainer.css('margin-top', 0);\n if (Y.UA.gecko) {\n t.pageContainer.css('padding-top', t.pageHeaderHeight + 30);\n t.pageHeader.css('top', 0);\n }\n\n t.handlePrintForOrdering(true);\n\n var promises = Ajax.call([{\n methodname: 'quiz_answersheets_create_event',\n args: {\n attemptid: t.mconfig.attemptid,\n userid: t.mconfig.userid,\n courseid: t.mconfig.courseid,\n cmid: t.mconfig.cmid,\n quizid: t.mconfig.quizid,\n pagetype: t.mconfig.pagetype\n }\n }]);\n // Handle promise.\n promises[0].then(function() {\n return true;\n }).fail(function(err) {\n Notification.exception(err);\n });\n },\n\n /**\n * Handle print stop event.\n *\n * @param {Event} e\n * @returns {boolean}\n */\n handlePrintStop: function(e) {\n e.preventDefault();\n t.pageContainer.css('margin-top', t.pageHeaderHeight);\n if (Y.UA.gecko) {\n t.pageContainer.css('padding-top', 0);\n t.pageHeader.css('top', -Math.abs(t.pageHeaderHeight));\n }\n t.handlePrintForOrdering(false);\n return true;\n },\n\n /**\n * Handle print for Ordering question type.\n *\n * @param {boolean} isPrinting\n */\n handlePrintForOrdering: function(isPrinting) {\n var sortablesVertical = $(t.SELECTOR.QTYPE_ORDERING_VERTICAL_SORTABLE_LIST);\n var sortablesHorizontal = $(t.SELECTOR.QTYPE_ORDERING_HORIZONTAL_SORTABLE_LIST);\n if (sortablesVertical.length || sortablesHorizontal.length) {\n if (isPrinting) {\n sortablesVertical.each(function(i, nodeSortableVertical) {\n // We already removed all the margin and padding in the CSS.\n // So we need to add extra spacing here.\n var marginEle = $(t.TEMPLATE.QTYPE_ORDERING_MARGIN);\n $(nodeSortableVertical).before(marginEle);\n $(nodeSortableVertical).after(marginEle);\n });\n\n sortablesHorizontal.each(function(i, nodeSortableHorizontal) {\n // Horizontal ordering is different with vertical.\n // So we need to wrap the sortable with a wrapper and add extra spacing later.\n var marginEle = $(t.TEMPLATE.QTYPE_ORDERING_MARGIN);\n marginEle.addClass('horizontal');\n $(nodeSortableHorizontal).after(marginEle);\n $(nodeSortableHorizontal).wrap(t.TEMPLATE.QTYPE_ORDERING_WRAPPER);\n });\n } else {\n // Remove all the margin placeholder.\n $(t.SELECTOR.QTYPE_ORDERING_MARGIN).remove();\n if (sortablesHorizontal.length) {\n sortablesHorizontal.each(function(i, nodeSortableHorizontal) {\n // Remove the wrapper for horizontal sortable.\n $(nodeSortableHorizontal).unwrap();\n });\n }\n }\n }\n }\n\n };\n\n return t;\n});\n"],"names":["define","$","Ajax","Notification","t","mconfig","SELECTOR","PAGE_HEADER","PAGE_CONTAINER","QTYPE_ORDERING_VERTICAL_SORTABLE_LIST","QTYPE_ORDERING_HORIZONTAL_SORTABLE_LIST","QTYPE_ORDERING_MARGIN","TEMPLATE","QTYPE_ORDERING_WRAPPER","pageHeaderHeight","pageContainer","pageHeader","init","options","height","css","Math","abs","window","addEventListener","handlePrintStart","handlePrintStop","e","preventDefault","Y","UA","gecko","handlePrintForOrdering","call","methodname","args","attemptid","userid","courseid","cmid","quizid","pagetype","then","fail","err","exception","isPrinting","sortablesVertical","sortablesHorizontal","length","each","i","nodeSortableVertical","marginEle","before","after","nodeSortableHorizontal","addClass","wrap","remove","unwrap"],"mappings":";;;;;;;AAuBAA,iCAAO,CAAC,SAAU,YAAa,sBAAsB,SAASC,EAAGC,KAAMC,kBAE/DC,EAAI,CAKJC,QAAS,KAKTC,SAAU,CACNC,YAAa,8BACbC,eAAgB,QACh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B,GAQXA,uBAAwB,SAASc,gBACzBC,kBAAoB9C,EAAEG,EAAEE,SAASG,uCACjCuC,oBAAsB/C,EAAEG,EAAEE,SAASI,0CACnCqC,kBAAkBE,QAAUD,oBAAoBC,UAC5CH,YACAC,kBAAkBG,MAAK,SAASC,EAAGC,0BAG3BC,UAAYpD,EAAEG,EAAEQ,SAASD,uBAC7BV,EAAEmD,sBAAsBE,OAAOD,WAC/BpD,EAAEmD,sBAAsBG,MAAMF,cAGlCL,oBAAoBE,MAAK,SAASC,EAAGK,4BAG7BH,UAAYpD,EAAEG,EAAEQ,SAASD,uBAC7B0C,UAAUI,SAAS,cACnBxD,EAAEuD,wBAAwBD,MAAMF,WAChCpD,EAAEuD,wBAAwBE,KAAKtD,EAAEQ,SAASC,6BAI9CZ,EAAEG,EAAEE,SAASK,uBAAuBgD,SAChCX,oBAAoBC,QACpBD,oBAAoBE,MAAK,SAASC,EAAGK,wBAEjCvD,EAAEuD,wBAAwBI,uBAS3CxD"} \ No newline at end of file diff --git a/amd/build/submit_student_responses.min.js b/amd/build/submit_student_responses.min.js index 783e334..bcd1c72 100644 --- a/amd/build/submit_student_responses.min.js +++ b/amd/build/submit_student_responses.min.js @@ -1,7 +1,7 @@ /** * Javascript for submit student responses * - * @package quiz_answersheets + * @module quiz_answersheets/submit_student_responses * @copyright 2019 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/amd/build/submit_student_responses.min.js.map b/amd/build/submit_student_responses.min.js.map index c1e6ba6..643c278 100644 --- a/amd/build/submit_student_responses.min.js.map +++ b/amd/build/submit_student_responses.min.js.map @@ -1 +1 @@ -{"version":3,"file":"submit_student_responses.min.js","sources":["../src/submit_student_responses.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript for submit student responses\n *\n * @package quiz_answersheets\n * @copyright 2019 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/notification'],\n function($, ModalFactory, ModalEvents, Notification) {\n\n var t = {\n\n SELECTOR: {\n SUBMIT_RESPONSES_BUTTON: '.submit-responses',\n RESPONSE_FORM: '#responseform'\n },\n\n /**\n * Initialise function\n *\n * @param {object} lang Lang string\n */\n init: function(lang) {\n var submitResponsesButton = $(t.SELECTOR.SUBMIT_RESPONSES_BUTTON);\n var responseForm = $(t.SELECTOR.RESPONSE_FORM);\n\n submitResponsesButton.click(function(e) {\n e.preventDefault();\n submitResponsesButton.attr('disabled', 'disabled');\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: lang.title,\n body: lang.body\n }).then(function(modal) {\n modal.show();\n modal.getRoot().on(ModalEvents.save, function(e) {\n e.preventDefault();\n submitResponsesButton.removeAttr('disabled');\n if (typeof M.core_formchangechecker !== 'undefined') {\n M.core_formchangechecker.set_form_submitted();\n }\n responseForm.submit();\n });\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n submitResponsesButton.removeAttr('disabled');\n });\n return modal;\n }).fail(function(err) {\n Notification.exception(err);\n submitResponsesButton.removeAttr('disabled');\n });\n });\n }\n };\n\n return t;\n});\n"],"names":["define","$","ModalFactory","ModalEvents","Notification","t","SELECTOR","SUBMIT_RESPONSES_BUTTON","RESPONSE_FORM","init","lang","submitResponsesButton","responseForm","click","e","preventDefault","attr","create","type","types","SAVE_CANCEL","title","body","then","modal","show","getRoot","on","save","removeAttr","M","core_formchangechecker","set_form_submitted","submit","hidden","destroy","fail","err","exception"],"mappings":";;;;;;;AAuBAA,oDAAO,CAAC,SAAU,qBAAsB,oBAAqB,sBACzD,SAASC,EAAGC,aAAcC,YAAaC,kBAEnCC,EAAI,CAEJC,SAAU,CACNC,wBAAyB,oBACzBC,cAAe,iBAQnBC,KAAM,SAASC,UACPC,sBAAwBV,EAAEI,EAAEC,SAASC,yBACrCK,aAAeX,EAAEI,EAAEC,SAASE,eAEhCG,sBAAsBE,OAAM,SAASC,GACjCA,EAAEC,iBACFJ,sBAAsBK,KAAK,WAAY,YACvCd,aAAae,OAAO,CAChBC,KAAMhB,aAAaiB,MAAMC,YACzBC,MAAOX,KAAKW,MACZC,KAAMZ,KAAKY,OACZC,MAAK,SAASC,cACbA,MAAMC,OACND,MAAME,UAAUC,GAAGxB,YAAYyB,MAAM,SAASd,GAC1CA,EAAEC,iBACFJ,sBAAsBkB,WAAW,iBACO,IAA7BC,EAAEC,wBACTD,EAAEC,uBAAuBC,qBAE7BpB,aAAaqB,YAEjBT,MAAME,UAAUC,GAAGxB,YAAY+B,QAAQ,WACnCV,MAAMW,UACNxB,sBAAsBkB,WAAW,eAE9BL,SACRY,MAAK,SAASC,KACbjC,aAAakC,UAAUD,KACvB1B,sBAAsBkB,WAAW,2BAM1CxB"} \ No newline at end of file +{"version":3,"file":"submit_student_responses.min.js","sources":["../src/submit_student_responses.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript for submit student responses\n *\n * @module quiz_answersheets/submit_student_responses\n * @copyright 2019 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/notification'],\n function($, ModalFactory, ModalEvents, Notification) {\n\n var t = {\n\n SELECTOR: {\n SUBMIT_RESPONSES_BUTTON: '.submit-responses',\n RESPONSE_FORM: '#responseform'\n },\n\n /**\n * Initialise function\n *\n * @param {object} lang Lang string\n */\n init: function(lang) {\n var submitResponsesButton = $(t.SELECTOR.SUBMIT_RESPONSES_BUTTON);\n var responseForm = $(t.SELECTOR.RESPONSE_FORM);\n\n submitResponsesButton.click(function(e) {\n e.preventDefault();\n submitResponsesButton.attr('disabled', 'disabled');\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: lang.title,\n body: lang.body\n }).then(function(modal) {\n modal.show();\n modal.getRoot().on(ModalEvents.save, function(e) {\n e.preventDefault();\n submitResponsesButton.removeAttr('disabled');\n if (typeof M.core_formchangechecker !== 'undefined') {\n M.core_formchangechecker.set_form_submitted();\n }\n responseForm.submit();\n });\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n submitResponsesButton.removeAttr('disabled');\n });\n return modal;\n }).fail(function(err) {\n Notification.exception(err);\n submitResponsesButton.removeAttr('disabled');\n });\n });\n }\n };\n\n return t;\n});\n"],"names":["define","$","ModalFactory","ModalEvents","Notification","t","SELECTOR","SUBMIT_RESPONSES_BUTTON","RESPONSE_FORM","init","lang","submitResponsesButton","responseForm","click","e","preventDefault","attr","create","type","types","SAVE_CANCEL","title","body","then","modal","show","getRoot","on","save","removeAttr","M","core_formchangechecker","set_form_submitted","submit","hidden","destroy","fail","err","exception"],"mappings":";;;;;;;AAuBAA,oDAAO,CAAC,SAAU,qBAAsB,oBAAqB,sBACzD,SAASC,EAAGC,aAAcC,YAAaC,kBAEnCC,EAAI,CAEJC,SAAU,CACNC,wBAAyB,oBACzBC,cAAe,iBAQnBC,KAAM,SAASC,UACPC,sBAAwBV,EAAEI,EAAEC,SAASC,yBACrCK,aAAeX,EAAEI,EAAEC,SAASE,eAEhCG,sBAAsBE,OAAM,SAASC,GACjCA,EAAEC,iBACFJ,sBAAsBK,KAAK,WAAY,YACvCd,aAAae,OAAO,CAChBC,KAAMhB,aAAaiB,MAAMC,YACzBC,MAAOX,KAAKW,MACZC,KAAMZ,KAAKY,OACZC,MAAK,SAASC,cACbA,MAAMC,OACND,MAAME,UAAUC,GAAGxB,YAAYyB,MAAM,SAASd,GAC1CA,EAAEC,iBACFJ,sBAAsBkB,WAAW,iBACO,IAA7BC,EAAEC,wBACTD,EAAEC,uBAAuBC,qBAE7BpB,aAAaqB,YAEjBT,MAAME,UAAUC,GAAGxB,YAAY+B,QAAQ,WACnCV,MAAMW,UACNxB,sBAAsBkB,WAAW,eAE9BL,SACRY,MAAK,SAASC,KACbjC,aAAakC,UAAUD,KACvB1B,sBAAsBkB,WAAW,2BAM1CxB"} \ No newline at end of file diff --git a/amd/src/create_attempt_dialog.js b/amd/src/create_attempt_dialog.js index e73ca5c..b44dcf8 100644 --- a/amd/src/create_attempt_dialog.js +++ b/amd/src/create_attempt_dialog.js @@ -17,7 +17,6 @@ * JavaScript for the create_attempt_dialog class. * * @module quiz_answersheets/create_attempt_dialog - * @package quiz_answersheets * @copyright 2019 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/amd/src/print.js b/amd/src/print.js index 22ae803..26d8174 100644 --- a/amd/src/print.js +++ b/amd/src/print.js @@ -16,7 +16,7 @@ /** * Javascript for print event. * - * @package quiz_answersheets + * @module quiz_answersheets/print * @copyright 2019 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/amd/src/submit_student_responses.js b/amd/src/submit_student_responses.js index 53cbcdc..526df2b 100644 --- a/amd/src/submit_student_responses.js +++ b/amd/src/submit_student_responses.js @@ -16,7 +16,7 @@ /** * Javascript for submit student responses * - * @package quiz_answersheets + * @module quiz_answersheets/submit_student_responses * @copyright 2019 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/changes.md b/changes.md index 9bab36c..5361f64 100644 --- a/changes.md +++ b/changes.md @@ -1,5 +1,10 @@ # Change log for the Export quiz attempts report +## Changes in 1.3 + +* This version works with Moodle 4.0. +* Replaced uses of deprecated user fields functions. (Note, this plugin does not yet support the display of custom profile fields.) +* Now shows improved instructions for bulk download. ## Changes in 1.2 diff --git a/classes/external.php b/classes/external.php index ab2140a..b6a1408 100644 --- a/classes/external.php +++ b/classes/external.php @@ -134,7 +134,7 @@ public static function quiz_prepare_and_start_new_attempt(quiz $quizobj, $attemp $quba = question_engine::make_questions_usage_by_activity('mod_quiz', $quizobj->get_context()); $quba->set_preferred_behaviour($quizobj->get_quiz()->preferredbehaviour); - // Create the new attempt and initialize the question sessions + // Create the new attempt and initialize the question sessions. $timenow = time(); // Update time now, in case the server is running really slowly. $attempt = quiz_create_attempt($quizobj, $attemptnumber, $lastattempt, $timenow, $ispreviewuser, $userid); diff --git a/tests/behat/attempt_and_answer_sheet.feature b/tests/behat/attempt_and_answer_sheet.feature index 0ff332a..63ef568 100644 --- a/tests/behat/attempt_and_answer_sheet.feature +++ b/tests/behat/attempt_and_answer_sheet.feature @@ -85,9 +85,7 @@ Feature: Attempt sheet, Review sheet and Answer sheet feature of the Answer shee And I should see "Three is odd." And I should see "Four is even." And user "student1" has finished an attempt at quiz "Quiz 1" - When I am on "Course 1" course homepage - And I follow "Quiz 1" - And I navigate to "Results > Export attempts" in current page administration + And I am on the "Quiz 1" "quiz_answersheets > Report" page logged in as "teacher" Then "Student One" row "Attempt sheets" column of "answersheets" table should contain "Review sheet" And "Student One" row "Answer sheets" column of "answersheets" table should contain "-" When I click on "Review sheet" "link" in the "Student One" "table_row" @@ -123,7 +121,7 @@ Feature: Attempt sheet, Review sheet and Answer sheet feature of the Answer shee | question | page | | RTC1 | 1 | And I am on the "quiz2" "Activity" page logged in as "student1" - And I click on "Attempt quiz now" "button" + And I click on "Attempt quiz" "button" And "student1" has recorded "moodle-sharon.ogg" into the record RTC question And I press "Finish attempt ..." And I press "Submit all and finish" diff --git a/tests/behat/attempt_sheet_for_dropdown.feature b/tests/behat/attempt_sheet_for_dropdown.feature index 94f8e14..b3fd640 100644 --- a/tests/behat/attempt_sheet_for_dropdown.feature +++ b/tests/behat/attempt_sheet_for_dropdown.feature @@ -25,8 +25,7 @@ Feature: Attempt sheet the Export attempt report @javascript Scenario: Dropdown list in Attempt sheet will be converted to list - Given I log in as "admin" - And I am on "Course 1" course homepage + Given I am on the "Course 1" "Course" page logged in as "admin" And I navigate to "Question bank" in current page administration And I add a "Select missing words" question filling the form with: | Question name | Select missing words | @@ -57,7 +56,7 @@ Feature: Attempt sheet the Export attempt report And user "student1" has started an attempt at quiz "Quiz 1" And I am on "Course 1" course homepage And I follow "Quiz 1" - And I navigate to "Results > Export attempts" in current page administration + And I am on the "Quiz 1" "quiz_answersheets > Report" page logged in as "admin" When I click on "Attempt sheet" "link" in the "Student One" "table_row" And I should see "[cat | sat | mat]" And I should see "London" diff --git a/tests/behat/basic.feature b/tests/behat/basic.feature index f1ac0d4..8740175 100644 --- a/tests/behat/basic.feature +++ b/tests/behat/basic.feature @@ -33,8 +33,7 @@ Feature: Basic use of the Answer sheets report @javascript Scenario: Answer sheets report works when there are no attempts - Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher" - When I navigate to "Results > Export attempts" in current page administration + Given I am on the "Quiz 1" "quiz_answersheets > Report" page logged in as "teacher" And I set the field "Attempts from" to "enrolled users who have attempted the quiz" Then I press "Show report" Then I should see "Attempts: 0" diff --git a/tests/behat/submit_student_responses.feature b/tests/behat/submit_student_responses.feature index 4ebf451..b38cdfb 100644 --- a/tests/behat/submit_student_responses.feature +++ b/tests/behat/submit_student_responses.feature @@ -59,16 +59,14 @@ Feature: Submit student responses feature of the Answer sheets report @javascript Scenario: Submit responses link available for overdue Given user "student1" has started an attempt at quiz "Quiz 1" - And I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher" - And I navigate to "Edit settings" in current page administration + And I am on the "Quiz 1" "quiz activity editing" page logged in as "teacher" And I set the following fields to these values: | id_timeclose_enabled | 1 | | id_timeclose_year | 2018 | | id_overduehandling | graceperiod | And I press "Save and display" And I run the scheduled task "mod_quiz\task\update_overdue_attempts" - When I am on the "Quiz 1" "mod_quiz > View" page - And I navigate to "Results > Export attempts" in current page administration + When I am on the "Quiz 1" "quiz_answersheets > Report" page logged in as "teacher" Then I should see "Attempts: 1" And I should see "Student One" And "Student One" row "State" column of "answersheets" table should contain "Overdue" diff --git a/version.php b/version.php index b33bb61..ea79dac 100644 --- a/version.php +++ b/version.php @@ -24,11 +24,11 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2020061500; -$plugin->requires = 2018120300; +$plugin->version = 2022033000; +$plugin->requires = 2021051700; $plugin->cron = 0; $plugin->component = 'quiz_answersheets'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = 'v1.2 for Moodle 3.9+'; +$plugin->release = 'v1.3 for Moodle 3.11+'; $plugin->outestssufficient = true;