MDL-66074 mod_forum: Grader module documentation
authorMathew May <mathewm@hotmail.co.nz>
Mon, 28 Oct 2019 05:14:39 +0000 (13:14 +0800)
committerMathew May <mathewm@hotmail.co.nz>
Wed, 30 Oct 2019 05:03:59 +0000 (13:03 +0800)
mod/forum/amd/build/local/grades/local/grader/gradingpanel.min.js.map
mod/forum/amd/build/local/grades/local/grader/selectors.min.js.map
mod/forum/amd/build/local/grades/local/grader/user_picker.min.js.map
mod/forum/amd/src/local/grades/local/grader/gradingpanel.js
mod/forum/amd/src/local/grades/local/grader/selectors.js
mod/forum/amd/src/local/grades/local/grader/user_picker.js

index a0b9112..dc9cfa7 100644 (file)
Binary files a/mod/forum/amd/build/local/grades/local/grader/gradingpanel.min.js.map and b/mod/forum/amd/build/local/grades/local/grader/gradingpanel.min.js.map differ
index 09295a0..4cbe9fe 100644 (file)
Binary files a/mod/forum/amd/build/local/grades/local/grader/selectors.min.js.map and b/mod/forum/amd/build/local/grades/local/grader/selectors.min.js.map differ
index 8f21051..2cd1640 100644 (file)
Binary files a/mod/forum/amd/build/local/grades/local/grader/user_picker.min.js.map and b/mod/forum/amd/build/local/grades/local/grader/user_picker.min.js.map differ
index 5d765f8..837a9d9 100644 (file)
@@ -24,6 +24,8 @@
 
 /**
  * Get the grade panel setter and getter for the current component.
+ * This function dynamically pulls the relevant gradingpanel JS file defined in the grading method.
+ * We do this because we do not know until execution time what the grading type is and we do not want to import unused files.
  *
  * @param {String} component The component being graded
  * @param {Number} context The contextid of the thing being graded
@@ -41,7 +43,7 @@ export default async(component, context, gradingComponent, gradingSubtype, itemN
     const GradingMethod = await import(gradingMethodHandler);
 
     return {
-        getter: userId => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),
+        getter: (userId) => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),
         setter: (userId, formData) => GradingMethod.storeCurrentGrade(component, context, itemName, userId, formData),
     };
 };
index a8889af..35e0339 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+/**
+ * A small helper function to build queryable data selectors.
+ * @param {String} name
+ * @param {String} value
+ * @return {string}
+ */
 const getDataSelector = (name, value) => {
     return `[data-${name}="${value}"]`;
 };
index f32ac59..889f429 100644 (file)
@@ -118,7 +118,7 @@ class UserPicker {
      * Register the event listeners for the user picker.
      */
     registerEventListeners() {
-        this.root.addEventListener('click', async e => {
+        this.root.addEventListener('click', async(e) => {
             const button = e.target.closest(Selectors.actions.changeUser);
             if (button) {
                 const result = await this.preChangeUserCallback(this.currentUser);
@@ -186,7 +186,11 @@ class UserPicker {
  * @param {Number} [currentUserID] The userid of the current user
  * @returns {UserPicker}
  */
-export default async(users, showUserCallback, preChangeUserCallback, {
+export default async(
+    users,
+    showUserCallback,
+    preChangeUserCallback,
+    {
         initialUserId = null,
     } = {}
 ) => {