Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-32207

assignment_count_real_submissions() for Advanced upload causes error

XMLWordPrintable

    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • wip-MDL-32207-master
    • Hide

      mod/assignment/type/upload/assignment.class.php, line 420

      s.data2 = 'submitted'", $params);

      ...needs to be...

      mod/assignment/type/upload/assignment.class.php, line 420

      {$DB->sql_compare_text('s.data2')} = 'submitted'", $params);

      Show
      mod/assignment/type/upload/assignment.class.php, line 420 s.data2 = 'submitted'", $params); ...needs to be... mod/assignment/type/upload/assignment.class.php, line 420 {$DB->sql_compare_text('s.data2')} = 'submitted'", $params);
    • Hide

      This needs to be tested on all DBs (esp. MS-SQL, PostgreSQL and Oracle).

      1. Login as Admin/Teacher
      2. Create a new assignment of type "Advanced upload of files"
      3. Add title and description, remaining settings can remain as defaults
      4. Click "Save and view"
      5. Check that you can see
        1. the assignment,
        2. the count of submissions at the top of the page ("No attempts have been made..."), and
        3. the count of submissions in the Settings block ("No attempts have been made").
      Show
      This needs to be tested on all DBs (esp. MS-SQL, PostgreSQL and Oracle). Login as Admin/Teacher Create a new assignment of type "Advanced upload of files" Add title and description, remaining settings can remain as defaults Click "Save and view" Check that you can see the assignment, the count of submissions at the top of the page ("No attempts have been made..."), and the count of submissions in the Settings block ("No attempts have been made").

      There is a comparison between a varchar and text field in assignment_count_real_submissions() than needs to be converted for comparison in non-mySQL DBs.

      *Replication steps:"

      1. In an MS-SQL instance (and probably Oracle and PostgreSQL also), create an Advanced Upload of Files assignment
      2. Attempt to view the new assignment

      The following error is shown.

      Error reading from database
      Debug info: SQLState: 42000<br>
      Error Code: 402<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types ntext and varchar are incompatible in the equal to operator.<br>
       
      SELECT COUNT('x')
      FROM mdl_assignment_submissions s
      LEFT JOIN mdl_assignment a ON a.id = s.assignment
      INNER JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      JOIN mdl_role_assignments eu1_ra3 ON (eu1_ra3.userid = eu1_u.id AND eu1_ra3.roleid IN (6,5,4,3,1) AND eu1_ra3.contextid IN (1,3,25,35))
      JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
      JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = '2')
      WHERE eu1_u.deleted = 0 AND eu1_u.id <> '1') u ON u.id = s.userid
      WHERE s.assignment = '1' AND
      s.data2 = 'submitted'
      [array (
      0 => '2',
      1 => '1',
      2 => '1',
      )]
      Stack trace:
       
          line 414 of \lib\dml\moodle_database.php: dml_read_exception thrown
          line 257 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
          line 374 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
          line 786 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query()
          line 821 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->get_recordset_sql()
          line 1339 of \lib\dml\moodle_database.php: call to sqlsrv_native_moodle_database->get_records_sql()
          line 1414 of \lib\dml\moodle_database.php: call to moodle_database->get_record_sql()
          line 1585 of \lib\dml\moodle_database.php: call to moodle_database->get_field_sql()
          line 420 of \mod\assignment\type\upload\assignment.class.php: call to moodle_database->count_records_sql()
          line 3941 of \mod\assignment\lib.php: call to assignment_upload->count_real_submissions()
          line 3601 of \lib\navigationlib.php: call to assignment_extend_settings_navigation()
          line 3009 of \lib\navigationlib.php: call to settings_navigation->load_module_settings()
          line 713 of \lib\pagelib.php: call to settings_navigation->initialise()
          line 729 of \lib\pagelib.php: call to moodle_page->magic_get_settingsnav()
          line 133 of \blocks\settings\block_settings.php: call to moodle_page->__get()
          line 280 of \blocks\moodleblock.class.php: call to block_settings->get_content()
          line 232 of \blocks\moodleblock.class.php: call to block_base->formatted_contents()
          line 929 of \lib\blocklib.php: call to block_base->get_content_for_output()
          line 981 of \lib\blocklib.php: call to block_manager->create_block_contents()
          line 352 of \lib\blocklib.php: call to block_manager->ensure_content_created()
          line 6 of \theme\base\layout\general.php: call to block_manager->region_has_content()
          line 764 of \lib\outputrenderers.php: call to include()
          line 711 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
          line ? of unknownfile: call to core_renderer->header()
          line 1409 of \lib\setuplib.php: call to call_user_func_array()
          line 194 of \mod\assignment\lib.php: call to bootstrap_renderer->__call()
          line 194 of \mod\assignment\lib.php: call to bootstrap_renderer->header()
          line 51 of \mod\assignment\type\upload\assignment.class.php: call to assignment_base->view_header()
          line 51 of \mod\assignment\view.php: call to assignment_upload->view()

            phalacee Jason Fowler
            salvetore Michael de Raadt
            Adrian Greeve Adrian Greeve
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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