MDL-66359 mod_forum: Restrict grader by groups
authorMathew May <mathewm@hotmail.co.nz>
Fri, 1 Nov 2019 05:39:48 +0000 (13:39 +0800)
committerMathew May <mathewm@hotmail.co.nz>
Thu, 7 Nov 2019 02:47:45 +0000 (10:47 +0800)
mod/forum/amd/build/grades/grader.min.js
mod/forum/amd/build/grades/grader.min.js.map
mod/forum/amd/src/grades/grader.js

index 0d1a46f..72dc9e0 100644 (file)
Binary files a/mod/forum/amd/build/grades/grader.min.js and b/mod/forum/amd/build/grades/grader.min.js differ
index 459670e..b904e3b 100644 (file)
Binary files a/mod/forum/amd/build/grades/grader.min.js.map and b/mod/forum/amd/build/grades/grader.min.js.map differ
index 61b151b..84e7bf7 100644 (file)
@@ -59,10 +59,11 @@ const getContentForUserIdFunction = (cmid) => (userid) => {
  * The function curried fetches all users in a course for a given CMID.
  *
  * @param {Number} cmid
+ * @param {Number} groupID
  * @return {Array} Array of users for a given context.
  */
-const getUsersForCmidFunction = (cmid) => async() => {
-    const context = await CourseRepository.getUsersFromCourseModuleID(cmid);
+const getUsersForCmidFunction = (cmid, groupID) => async() => {
+    const context = await CourseRepository.getUsersFromCourseModuleID(cmid, groupID);
 
     return context.users;
 };
@@ -112,8 +113,10 @@ const launchWholeForumGrading = async(rootNode) => {
         data.gradableItemtype
     );
 
+    const groupID = data.group ? data.group : 0;
+
     await Grader.launch(
-        getUsersForCmidFunction(data.cmid),
+        getUsersForCmidFunction(data.cmid, groupID),
         getContentForUserIdFunction(data.cmid),
         gradingPanelFunctions.getter,
         gradingPanelFunctions.setter,