MDL-66958 core_grade: Only save scale on form change
authorMathew May <mathewm@hotmail.co.nz>
Tue, 5 Nov 2019 09:43:36 +0000 (17:43 +0800)
committerMathew May <mathewm@hotmail.co.nz>
Mon, 11 Nov 2019 03:25:17 +0000 (11:25 +0800)
grade/amd/build/grades/grader/gradingpanel/scale.min.js
grade/amd/build/grades/grader/gradingpanel/scale.min.js.map
grade/amd/src/grades/grader/gradingpanel/scale.js

index edb9c07..3c3b6f2 100644 (file)
Binary files a/grade/amd/build/grades/grader/gradingpanel/scale.min.js and b/grade/amd/build/grades/grader/gradingpanel/scale.min.js differ
index 7ceeb00..e79a065 100644 (file)
Binary files a/grade/amd/build/grades/grader/gradingpanel/scale.min.js.map and b/grade/amd/build/grades/grader/gradingpanel/scale.min.js.map differ
index 3caca5e..543eab1 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 import {saveGrade, fetchGrade} from './repository';
+import {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';
 // Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()
 import jQuery from 'jquery';
 import {invalidResult} from './normalise';
@@ -37,5 +38,9 @@ export const storeCurrentGrade = (component, context, itemname, userId, rootNode
         return invalidResult;
     }
 
-    return saveGrade('scale')(component, context, itemname, userId, jQuery(form).serialize());
+    if (compareData(form) === true) {
+        return saveGrade('scale')(component, context, itemname, userId, jQuery(form).serialize());
+    } else {
+        return '';
+    }
 };