MDL-66360 core_grade: grade notifications for simple direct grading
This commit is contained in:
committed by
Simey Lameze
parent
9672c8aa08
commit
4fe3ce8f64
+1
-1
@@ -1,2 +1,2 @@
|
||||
define ("core_grades/grades/grader/gradingpanel/point",["exports","./repository","core_grades/grades/grader/gradingpanel/comparison","jquery","./normalise"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;d=function(a){return a&&a.__esModule?a:{default:a}}(d);function f(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(){return(0,b.fetchGrade)("point").apply(void 0,arguments)};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j){var k,l;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:k=j.querySelector("form");l=k.querySelector("input[name=\"grade\"]");if(!(!l.checkValidity()||!l.value.trim())){a.next=4;break}return a.abrupt("return",e.invalidResult);case 4:if(!(!0===(0,c.compareData)(k))){a.next=10;break}a.next=7;return(0,b.saveGrade)("point")(f,g,h,i,(0,d.default)(k).serialize());case 7:return a.abrupt("return",a.sent);case 10:return a.abrupt("return","");case 11:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
define ("core_grades/grades/grader/gradingpanel/point",["exports","./repository","core_grades/grades/grader/gradingpanel/comparison","jquery","./normalise"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;d=function(a){return a&&a.__esModule?a:{default:a}}(d);function f(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(){return(0,b.fetchGrade)("point").apply(void 0,arguments)};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j){var k,l,m,n=arguments;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:k=5<n.length&&n[5]!==void 0?n[5]:!1;l=j.querySelector("form");m=l.querySelector("input[name=\"grade\"]");if(!(!m.checkValidity()||!m.value.trim())){a.next=5;break}return a.abrupt("return",e.invalidResult);case 5:if(!(!0===(0,c.compareData)(l))){a.next=11;break}a.next=8;return(0,b.saveGrade)("point")(f,g,h,i,(0,d.default)(l).serialize(),k);case 8:return a.abrupt("return",a.sent);case 11:return a.abrupt("return","");case 12:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
//# sourceMappingURL=point.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/point.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","rootNode","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA2BA,uD,mVAaiC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAY1B,GAAMC,CAAAA,CAAiB,4CAAG,WAAMC,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAAoCC,CAApC,CAA4CC,CAA5C,2FACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,CAEvBC,CAFuB,CAEfF,CAAI,CAACC,aAAL,CAAmB,uBAAnB,CAFe,MAIzB,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAJF,2CAKlBC,eALkB,cAQzB,uBAAYN,CAAZ,CARyB,kCASZ,gBAAU,OAAV,EAAmBL,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyD,cAAOE,CAAP,EAAaO,SAAb,EAAzD,CATY,0EAWlB,EAXkB,2CAAH,uDAAvB,C","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 <http://www.gnu.org/licenses/>.\n\n/**\n * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/point\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\n/**\n * Fetch the current grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @return {Object}\n */\nexport const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);\n\n/**\n * Store a new grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @return {Object}\n */\nexport const storeCurrentGrade = async(component, context, itemname, userId, rootNode) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('input[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return await saveGrade('point')(component, context, itemname, userId, jQuery(form).serialize());\n } else {\n return '';\n }\n};\n"],"file":"point.min.js"}
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/point.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","rootNode","notifyUser","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA2BA,uD,mVAaiC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAa1B,GAAMC,CAAAA,CAAiB,4CAAG,WAAMC,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAAoCC,CAApC,CAA4CC,CAA5C,yGAAsDC,CAAtD,mCACvBC,CADuB,CAChBF,CAAQ,CAACG,aAAT,CAAuB,MAAvB,CADgB,CAEvBC,CAFuB,CAEfF,CAAI,CAACC,aAAL,CAAmB,uBAAnB,CAFe,MAIzB,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAJF,2CAKlBC,eALkB,cAQzB,uBAAYN,CAAZ,CARyB,kCASZ,gBAAU,OAAV,EAAmBN,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyD,cAAOG,CAAP,EAAaO,SAAb,EAAzD,CAAmFR,CAAnF,CATY,0EAWlB,EAXkB,2CAAH,uDAAvB,C","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 <http://www.gnu.org/licenses/>.\n\n/**\n * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/point\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\n/**\n * Fetch the current grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @return {Object}\n */\nexport const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);\n\n/**\n * Store a new grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @param {Boolean} notifyUser\n * @return {Object}\n */\nexport const storeCurrentGrade = async(component, context, itemname, userId, rootNode, notifyUser = false) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('input[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return await saveGrade('point')(component, context, itemname, userId, jQuery(form).serialize(), notifyUser);\n } else {\n return '';\n }\n};\n"],"file":"point.min.js"}
|
||||
@@ -1,2 +1,2 @@
|
||||
define ("core_grades/grades/grader/gradingpanel/repository",["exports","core/ajax","./normalise"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.saveGrade=a.fetchGrade=void 0;function d(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function e(a){return function(){var b=this,c=arguments;return new Promise(function(e,f){var i=a.apply(b,c);function g(a){d(i,e,f,g,h,"next",a)}function h(a){d(i,e,f,g,h,"throw",a)}g(void 0)})}}a.fetchGrade=function fetchGrade(a){return function(c,d,e,f){return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_fetch"),args:{component:c,contextid:d,itemname:e,gradeduserid:f}}])[0]}};a.saveGrade=function saveGrade(a){return function(){var d=e(regeneratorRuntime.mark(function d(e,f,g,h,i){return regeneratorRuntime.wrap(function(d){while(1){switch(d.prev=d.next){case 0:d.t0=c.normaliseResult;d.next=3;return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_store"),args:{component:e,contextid:f,itemname:g,gradeduserid:h,formdata:i}}])[0];case 3:d.t1=d.sent;return d.abrupt("return",(0,d.t0)(d.t1));case 5:case"end":return d.stop();}}},d)}));return function(){return d.apply(this,arguments)}}()}});
|
||||
define ("core_grades/grades/grader/gradingpanel/repository",["exports","core/ajax","./normalise"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.saveGrade=a.fetchGrade=void 0;function d(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function e(a){return function(){var b=this,c=arguments;return new Promise(function(e,f){var i=a.apply(b,c);function g(a){d(i,e,f,g,h,"next",a)}function h(a){d(i,e,f,g,h,"throw",a)}g(void 0)})}}a.fetchGrade=function fetchGrade(a){return function(c,d,e,f){return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_fetch"),args:{component:c,contextid:d,itemname:e,gradeduserid:f}}])[0]}};a.saveGrade=function saveGrade(a){return function(){var d=e(regeneratorRuntime.mark(function d(e,f,g,h,i){var j,k=arguments;return regeneratorRuntime.wrap(function(d){while(1){switch(d.prev=d.next){case 0:j=5<k.length&&k[5]!==void 0?k[5]:!1;d.t0=c.normaliseResult;d.next=4;return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_store"),args:{component:e,contextid:f,itemname:g,gradeduserid:h,formdata:i,notifyuser:j}}])[0];case 4:d.t1=d.sent;return d.abrupt("return",(0,d.t0)(d.t1));case 6:case"end":return d.stop();}}},d)}));return function(){return d.apply(this,arguments)}}()}});
|
||||
//# sourceMappingURL=repository.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/repository.js"],"names":["fetchGrade","type","component","contextid","itemname","gradeduserid","methodname","args","saveGrade","formdata","normaliseResult"],"mappings":"4hBA0B0B,QAAbA,CAAAA,UAAa,CAAAC,CAAI,QAAI,UAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAChF,MAAO,WAAU,CAAC,CACdC,UAAU,2CAAqCL,CAArC,UADI,CAEdM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,CAV6B,C,aAYL,QAAZG,CAAAA,SAAY,CAAAP,CAAI,oDAAI,WAAMC,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,wFACtBC,iBADsB,gBACA,WAAU,CAAC,CACpCJ,UAAU,2CAAqCL,CAArC,UAD0B,CAEpCM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFI,QAAQ,CAARA,CALE,CAF8B,CAAD,CAAV,EASzB,CATyB,CADA,qGAAJ,wD","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 <http://www.gnu.org/licenses/>.\n\n/**\n * Repository for simple direct grading panel.\n *\n * @module core_grades/grades/grader/gradingpanel/repository\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from './normalise';\n\nexport const fetchGrade = type => (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\nexport const saveGrade = type => async(component, contextid, itemname, gradeduserid, formdata) => {\n return normaliseResult(await fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n formdata,\n },\n }])[0]);\n};\n"],"file":"repository.min.js"}
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/repository.js"],"names":["fetchGrade","type","component","contextid","itemname","gradeduserid","methodname","args","saveGrade","formdata","notifyuser","normaliseResult"],"mappings":"4hBA0B0B,QAAbA,CAAAA,UAAa,CAAAC,CAAI,QAAI,UAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAChF,MAAO,WAAU,CAAC,CACdC,UAAU,2CAAqCL,CAArC,UADI,CAEdM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,CAV6B,C,aAYL,QAAZG,CAAAA,SAAY,CAAAP,CAAI,oDAAI,WAAMC,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,qGAA8DC,CAA9D,wCACtBC,iBADsB,gBACA,WAAU,CAAC,CACpCL,UAAU,2CAAqCL,CAArC,UAD0B,CAEpCM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFI,QAAQ,CAARA,CALE,CAMFC,UAAU,CAAVA,CANE,CAF8B,CAAD,CAAV,EAUzB,CAVyB,CADA,qGAAJ,wD","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 <http://www.gnu.org/licenses/>.\n\n/**\n * Repository for simple direct grading panel.\n *\n * @module core_grades/grades/grader/gradingpanel/repository\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from './normalise';\n\nexport const fetchGrade = type => (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\nexport const saveGrade = type => async(component, contextid, itemname, gradeduserid, formdata, notifyuser = false) => {\n return normaliseResult(await fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n formdata,\n notifyuser,\n },\n }])[0]);\n};\n"],"file":"repository.min.js"}
|
||||
@@ -48,9 +48,10 @@ export const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);
|
||||
* @param {String} itemname
|
||||
* @param {Number} userId
|
||||
* @param {Element} rootNode
|
||||
* @param {Boolean} notifyUser
|
||||
* @return {Object}
|
||||
*/
|
||||
export const storeCurrentGrade = async(component, context, itemname, userId, rootNode) => {
|
||||
export const storeCurrentGrade = async(component, context, itemname, userId, rootNode, notifyUser = false) => {
|
||||
const form = rootNode.querySelector('form');
|
||||
const grade = form.querySelector('input[name="grade"]');
|
||||
|
||||
@@ -59,7 +60,7 @@ export const storeCurrentGrade = async(component, context, itemname, userId, roo
|
||||
}
|
||||
|
||||
if (compareData(form) === true) {
|
||||
return await saveGrade('point')(component, context, itemname, userId, jQuery(form).serialize());
|
||||
return await saveGrade('point')(component, context, itemname, userId, jQuery(form).serialize(), notifyUser);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export const fetchGrade = type => (component, contextid, itemname, gradeduserid)
|
||||
}])[0];
|
||||
};
|
||||
|
||||
export const saveGrade = type => async(component, contextid, itemname, gradeduserid, formdata) => {
|
||||
export const saveGrade = type => async(component, contextid, itemname, gradeduserid, formdata, notifyuser = false) => {
|
||||
return normaliseResult(await fetchMany([{
|
||||
methodname: `core_grades_grader_gradingpanel_${type}_store`,
|
||||
args: {
|
||||
@@ -45,6 +45,7 @@ export const saveGrade = type => async(component, contextid, itemname, gradeduse
|
||||
itemname,
|
||||
gradeduserid,
|
||||
formdata,
|
||||
notifyuser,
|
||||
},
|
||||
}])[0]);
|
||||
};
|
||||
|
||||
@@ -82,6 +82,12 @@ class store extends external_api {
|
||||
'The serialised form data representing the grade',
|
||||
VALUE_REQUIRED
|
||||
),
|
||||
'notifyuser' => new external_value(
|
||||
PARAM_BOOL,
|
||||
'Wheteher to notify the user or not',
|
||||
VALUE_DEFAULT,
|
||||
false
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -93,6 +99,7 @@ class store extends external_api {
|
||||
* @param string $itemname
|
||||
* @param int $gradeduserid
|
||||
* @param string $formdata
|
||||
* @param bool $notifyuser
|
||||
* @return array
|
||||
* @throws \dml_exception
|
||||
* @throws \invalid_parameter_exception
|
||||
@@ -101,7 +108,8 @@ class store extends external_api {
|
||||
* @throws moodle_exception
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid, string $formdata): array {
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid, string $formdata,
|
||||
bool $notifyuser): array {
|
||||
global $USER;
|
||||
|
||||
[
|
||||
@@ -151,8 +159,14 @@ class store extends external_api {
|
||||
|
||||
// Grade.
|
||||
$gradeitem->store_grade_from_formdata($gradeduser, $USER, (object) $data);
|
||||
|
||||
$hasgrade = $gradeitem->user_has_grade($gradeduser);
|
||||
|
||||
// Notify.
|
||||
if ($notifyuser) {
|
||||
// Send notification.
|
||||
$gradeitem->send_student_notification($gradeduser, $USER);
|
||||
}
|
||||
|
||||
// Fetch the updated grade back out.
|
||||
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user