turnitin/moodle-plagiarism_turnitin

Error on "View the Rubric used for marking" as a student

sleitao opened this issue · 5 comments

When submitting an assignment as a student, if I click "View the Rubric used for marking" I get the following error:

Exception - Argument 2 passed to has_capability() must be an instance of context, null given, called in [dirroot]/plagiarism/turnitin/ajax.php on line 162

$plugin->version = 2020072201;

jonof commented

This is a fix we're presently evaluating:

index 863d466..fef68fd 100644
--- a/amd/src/rubric.js
+++ b/amd/src/rubric.js
@@ -37,11 +37,13 @@ define(['jquery',
             },
             rubricCreateModal: function(modalType) {
                 var courseid = ($('input[name="course"]')) ? $('input[name="course"]').val() : 0;
+                var cmid = $('input[name="coursemodule"], input[name="id"]').val() || 0;
 
                 ModalFactory.create({
                     type: modalType,
                     templateContext: {
                         courseid: courseid,
+                        cmid: cmid,
                         wwwroot: M.cfg.wwwroot
                     },
                     large: true
@@ -53,4 +55,4 @@ define(['jquery',
                     });
             }
         };
-    });
\ No newline at end of file
+    });
jonof commented

It seems my fix is not enough to solve the error you still get if you click the rubric icon once a submission is no longer editable and there's no form from which the plugin can steal the cmid or courseid. I'll contemplate a more robust solution.

jonof commented

This alternative works reliably from our testing: jonof@385f22ec7ec0eade8a2bc13fe6f85cf79d630577

Hey @jonof - can you make a PR for that please?