Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3949

Cookie turnitintool_choice_user breaks ability to view TII assignment



    • Bug
    • Resolution: Unresolved
    • Critical
    • None
    • 2.2.5
    • Module: Turnitintool
    • None


      We have an TII assignment which has submissions. One of those submissions is for a non-moodle user (not sure how a non-moodle user would even manage to submit anything!).

      Viewing the assignment works fine until you view the list of submissions (/mod/turnitintool/view.php?id=2930&do=allsubmissions). At this point, the turnitintool_choice_user cookie is set.
      This cookie appears to contain the userid for each of the users with submissions.
      Because there is a non-moodle user present, the cookie include a userid of nm-xxxxxxx making the total cookie something akin to:


      When a user views subsequent pages within mod/turnitintool - for example the Intro page (/mod/turnitintool/view.php?id=2930&do=intro), they are shown an 'Error reading from database'. The only way to rid themselves of this error is to clear the cookie from their browser.

      To replicate:

      • Create a new Turnitin assignment
        • Enable Anonymous marking
      • Either:
        • Upload an assignment for an enrolled user and then Unenrol that user; or
        • Upload an assignment for an unenrolled user using the web interface
      • Update the assignment part
        • Make the due date and the post date to something now passed (or wait until your post date has naturally past... could take a while)
      • View the Submission Inbox
      • Hit the 'Refresh Submissions' button for good measure
      • Open your browsers inspector and look at the cookie
        • The cookie now include a user with nm-XXXX
      • View the Summary Page
        • BANG:

          Debug info: ERROR: invalid input syntax for integer: "nm-3703529"
          SELECT COUNT('x') FROM mdl_turnitintool_submissions WHERE submission_part = $1 AND turnitintoolid = $2 AND userid IS NULL
          [array (
          0 => 'nm-3703529',
          1 => '2',
          Error code: dmlreadexception
          Stack trace:
          line 407 of /lib/dml/moodle_database.php: dml_read_exception thrown
          line 239 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
          line 699 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
          line 1337 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
          line 1410 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
          line 1581 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
          line 1564 of /lib/dml/moodle_database.php: call to moodle_database->count_records_sql()
          line 1547 of /lib/dml/moodle_database.php: call to moodle_database->count_records_select()
          line 6763 of /mod/turnitintool/lib.php: call to moodle_database->count_records()
          line 4859 of /mod/turnitintool/lib.php: call to turnitintool_count_records()
          line 67 of /mod/turnitintool/view.php: call to turnitintool_update_choice_cookie()




            paul.dawson Paul Dawson
            dobedobedoh Andrew Lyons
            0 Vote for this issue
            0 Start watching this issue




                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.